WebClient.UploadProgressChanged イベント
アセンブリ: System (system.dll 内)

Dim instance As WebClient Dim handler As UploadProgressChangedEventHandler AddHandler instance.UploadProgressChanged, handler
public: event UploadProgressChangedEventHandler^ UploadProgressChanged { void add (UploadProgressChangedEventHandler^ value); void remove (UploadProgressChangedEventHandler^ value); }

このイベントは、非同期アップロードが進行するたびに発生します。このイベントは、次のメソッドのいずれかを使用してアップロードが開始されたときに発生します。
UploadDataAsync | |
UploadFileAsync | |
UploadValuesAsync | 呼び出し元のスレッドをブロックせずに、リソースに NameValueCollection を送信し、任意の応答を含む Byte 配列を返します。 |
UploadProgressChangedEventHandler は、このイベントのデリゲートです。UploadProgressChangedEventArgs クラスは、イベント ハンドラにイベント データを提供します。

このイベントのイベント ハンドラを設定するコード例を次に示します。
' Sample call: UploadFileInBackground2("http:' www.contoso.com/fileUpload.aspx", "data.txt") Public Shared Sub UploadFileInBackground2(ByVal address As String, ByVal fileName As String) Dim client As WebClient = New WebClient() Dim uri as Uri = New Uri(address) AddHandler client.UploadFileCompleted, AddressOf UploadFileCallback2 ' Specify a progress notification handler. AddHandler client.UploadProgressChanged, AddressOf UploadProgressCallback client.UploadFileAsync(uri, "POST", fileName) Console.WriteLine("File upload started.") End Sub
// Sample call: UploadFileInBackground2("http://www.contoso.com/fileUpload.aspx", "data.txt") public static void UploadFileInBackground2 (string address, string fileName) { WebClient client = new WebClient (); Uri uri = new Uri(address); client.UploadFileCompleted += new UploadFileCompletedEventHandler (UploadFileCallback2); // Specify a progress notification handler. client.UploadProgressChanged += new UploadProgressChangedEventHandler(UploadProgressCallback); client.UploadFileAsync (uri, "POST", fileName); Console.WriteLine ("File upload started."); }
Shared Sub UploadProgressCallback(ByVal sender As Object, ByVal e As UploadProgressChangedEventArgs) ' Displays the operation identifier, and the transfer progress. Console.WriteLine("{0} uploaded {1} of {2} bytes. {3} % complete...", _ CStr(e.UserState), e.BytesSent, e.TotalBytesToSend, e.ProgressPercentage) End Sub Shared Sub DownloadProgressCallback(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) ' Displays the operation identifier, and the transfer progress. Console.WriteLine("0} downloaded 1} of 2} bytes. 3} % complete...", _ CStr(e.UserState), e.BytesReceived, e.TotalBytesToReceive, e.ProgressPercentage) End Sub
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); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からWebClient.UploadProgressChanged イベントを検索する場合は、下記のリンクをクリックしてください。

- WebClient.UploadProgressChanged イベントのページへのリンク