DeploymentProgressChangedEventArgsとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DeploymentProgressChangedEventArgsの意味・解説 

DeploymentProgressChangedEventArgs クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

非同期操作で報告される進行状況データを表します。

名前空間: System.Deployment.Application
アセンブリ: System.Deployment (system.deployment.dll 内)
構文構文

Public Class DeploymentProgressChangedEventArgs
    Inherits ProgressChangedEventArgs
Dim instance As DeploymentProgressChangedEventArgs
public class DeploymentProgressChangedEventArgs
 : ProgressChangedEventArgs
public ref class DeploymentProgressChangedEventArgs
 : public ProgressChangedEventArgs
public class DeploymentProgressChangedEventArgs
 extends ProgressChangedEventArgs
public class DeploymentProgressChangedEventArgs
 extends ProgressChangedEventArgs
解説解説

このクラスには、CheckForUpdateProgressChanged イベント、DownloadFileGroupProgressChanged イベント、および UpdateProgressChanged イベントの進行状況を説明するプロパティが含まれています。このクラスのすべてのプロパティが各イベントに適用されるわけではありません。

BytesCompleted および BytesTotal は、それぞれが現在までにダウンロードされた合計バイト数とダウンロード操作の合計バイト数を表し、3 つのイベントすべてに適用されます。Group は、現在の DownloadFileGroupProgressChanged イベントに対応するファイル グループの名前を取得し、State は、ダウンロード操作の現在の段階を反映します。

使用例使用例

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.Object
   System.EventArgs
     System.ComponentModel.ProgressChangedEventArgs
      System.Deployment.Application.DeploymentProgressChangedEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DeploymentProgressChangedEventArgs メンバ
System.Deployment.Application 名前空間
DeploymentProgressChangedEventHandler

DeploymentProgressChangedEventArgs プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ BytesCompleted この操作によって既にダウンロードされているバイト数を取得します。
パブリック プロパティ BytesTotal ダウンロード操作の合計バイト数を取得します。
パブリック プロパティ Group ダウンロードされるファイル グループの名前を取得します。
パブリック プロパティ ProgressPercentage  非同期タスクの進行状況の割合を取得します。 ( ProgressChangedEventArgs から継承されます。)
パブリック プロパティ State プロセスが現在実行しているアクションを取得します。
パブリック プロパティ UserState  一意のユーザー状態を取得します。 ( ProgressChangedEventArgs から継承されます。)
参照参照

関連項目

DeploymentProgressChangedEventArgs クラス
System.Deployment.Application 名前空間
DeploymentProgressChangedEventHandler

DeploymentProgressChangedEventArgs メソッド


DeploymentProgressChangedEventArgs メンバ

非同期操作で報告される進行状況データを表します。

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


パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ BytesCompleted この操作によって既にダウンロードされているバイト数を取得します。
パブリック プロパティ BytesTotal ダウンロード操作の合計バイト数を取得します。
パブリック プロパティ Group ダウンロードされるファイル グループの名前を取得します。
パブリック プロパティ ProgressPercentage  非同期タスクの進行状況の割合を取得します。(ProgressChangedEventArgs から継承されます。)
パブリック プロパティ State プロセスが現在実行しているアクションを取得します。
パブリック プロパティ UserState  一意のユーザー状態を取得します。(ProgressChangedEventArgs から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DeploymentProgressChangedEventArgs クラス
System.Deployment.Application 名前空間
DeploymentProgressChangedEventHandler



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「DeploymentProgressChangedEventArgs」の関連用語

DeploymentProgressChangedEventArgsのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DeploymentProgressChangedEventArgsのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS