DownloadFileGroupCompletedEventArgs クラス
アセンブリ: System.Deployment (system.deployment.dll 内)


HelpFiles という名前のファイル グループをダウンロードして、ステータス バーにダウンロードの進行状況を表示するコード例を次に示します。この例では、Windows フォーム アプリケーションを配置し、メイン フォームに StatusStrip コントロールと、downloadStatus という名前の ToolStripStatusPanel コントロールを用意する必要があります。
Dim WithEvents ADDownloadHelpFiles As ApplicationDeployment Private Sub DownloadHelpFiles(ByVal GroupName As String) If (ApplicationDeployment.IsNetworkDeployed) Then ADDownloadHelpFiles = ApplicationDeployment.CurrentDeployment If ADDownloadHelpFiles.IsFirstRun Then Try If ADDownloadHelpFiles.IsFileGroupDownloaded(GroupName) Then ADDownloadHelpFiles.DownloadFileGroupAsync(GroupName) End If Catch ioe As InvalidOperationException MessageBox.Show("This application is not a ClickOnce application.") Return End Try End If End If End Sub Sub ADDownloadHelpFiles_DownloadFileGroupProgressChanged(ByVal sender As Object, ByVal e As DeploymentProgressChangedEventArgs) Handles ADDownloadHelpFiles.DownloadFileGroupProgressChanged DownloadStatus.Text = String.Format("Downloading file group {0}; {1:D}K of {2:D}K completed.", e.Group, e.BytesCompleted / 1024, e.BytesTotal / 1024) End Sub Sub ADDownloadHelpFiles_DownloadFileGroupCompleted(ByVal sender As Object, ByVal e As DownloadFileGroupCompletedEventArgs) Handles ADDownloadHelpFiles.DownloadFileGroupCompleted DownloadStatus.Text = String.Format("Download of file group {0} complete.", e.Group) End Sub
private void DownloadFileGroupAsync(string fileGroup) { if (ApplicationDeployment.IsNetworkDeployed) { ApplicationDeployment deployment = ApplicationDeployment.CurrentDeployment; try { if (deployment.IsFileGroupDownloaded(fileGroup)) { deployment.DownloadFileGroupProgressChanged += new DeploymentProgressChangedEventHandler(deployment_DownloadFileGroupProgressChanged); deployment.DownloadFileGroupCompleted += new DownloadFileGroupCompletedEventHandler(deployment_DownloadFileGroupCompleted); deployment.DownloadFileGroupAsync(fileGroup); } } catch (InvalidOperationException ioe) { MessageBox.Show("This application is not a ClickOnce application. Error: " + ioe.Message); return; } } } void deployment_DownloadFileGroupProgressChanged(object sender, DeploymentProgressChangedEventArgs e) { downloadStatus.Text = String.Format("Downloading file group {0}; {1:D}K of {2:D}K completed.", e.Group, e.BytesCompleted / 1024, e.BytesTotal / 1024); } void deployment_DownloadFileGroupCompleted(object sender, DownloadFileGroupCompletedEventArgs e) { if (e.Error != null) { downloadStatus.Text = "Could not download files. Will try again later."; return; } else if (e.Cancelled) { downloadStatus.Text = "The file download has been cancelled."; return; } downloadStatus.Text = String.Format("Download of file group {0} complete.", e.Group); }
void LaunchAppUpdate() { if (ApplicationDeployment::IsNetworkDeployed) { ApplicationDeployment^ ad = ApplicationDeployment::CurrentDeployment; ad->UpdateCompleted += gcnew AsyncCompletedEventHandler(this, &Form1::LaunchAppUpdate_UpdateCompleted); ad->UpdateAsync(); } } void LaunchAppUpdate_UpdateCompleted(Object^ sender, AsyncCompletedEventArgs^ e) { if (!e->Cancelled) { if (nullptr != e->Error) { System::Windows::Forms::DialogResult dr = MessageBox::Show( "The application has been updated. Restart?", "Restart Application", MessageBoxButtons::OKCancel); if (System::Windows::Forms::DialogResult::OK == dr) { Application::Restart(); } } else { // Replace with your own error reporting or logging. MessageBox::Show( "The application encountered an error in " + "downloading the latest update. Error: {0}", e->Error->Message); } } else { // Replace with your own error reporting or logging. MessageBox::Show( "The update of the application's latest version was " + "cancelled."); } }

System.EventArgs
System.ComponentModel.AsyncCompletedEventArgs
System.Deployment.Application.DownloadFileGroupCompletedEventArgs


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DownloadFileGroupCompletedEventArgs プロパティ

名前 | 説明 | |
---|---|---|
![]() | Cancelled | 非同期操作がキャンセルされたかどうかを示す値を取得します。 ( AsyncCompletedEventArgs から継承されます。) |
![]() | Error | 非同期操作中に発生したエラーを示す値を取得します。 ( AsyncCompletedEventArgs から継承されます。) |
![]() | Group | ダウンロードされるファイル グループの名前を取得します。 |
![]() | UserState | 非同期タスクの一意の識別子を取得します。 ( AsyncCompletedEventArgs から継承されます。) |

DownloadFileGroupCompletedEventArgs メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |
![]() | RaiseExceptionIfNecessary | 非同期操作が失敗した場合は、ユーザー指定の例外を発生させます。 ( AsyncCompletedEventArgs から継承されます。) |

DownloadFileGroupCompletedEventArgs メンバ
DownloadFileGroupCompletedEventArgs データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | Cancelled | 非同期操作がキャンセルされたかどうかを示す値を取得します。(AsyncCompletedEventArgs から継承されます。) |
![]() | Error | 非同期操作中に発生したエラーを示す値を取得します。(AsyncCompletedEventArgs から継承されます。) |
![]() | Group | ダウンロードされるファイル グループの名前を取得します。 |
![]() | UserState | 非同期タスクの一意の識別子を取得します。(AsyncCompletedEventArgs から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |
![]() | RaiseExceptionIfNecessary | 非同期操作が失敗した場合は、ユーザー指定の例外を発生させます。 (AsyncCompletedEventArgs から継承されます。) |

- DownloadFileGroupCompletedEventArgsのページへのリンク