Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DeploymentProgressChangedEventArgs::BytesCompleted Property

 

Gets the number of bytes already downloaded by this operation.

Namespace:   System.Deployment.Application
Assembly:  System.Deployment (in System.Deployment.dll)

public:
property long long BytesCompleted {
	long long get();
}

Property Value

Type: System::Int64

An Int64 representing the data already transferred, in bytes.

For CheckForUpdateProgressChanged, the BytesCompleted property refers to the downloading of the deployment manifest. For UpdateProgressChanged, the property refers to the download progress of the entire update, included the manifests, assemblies, and data files. For DownloadFileGroupProgressChanged, the property refers to the download progress of the entire set of files that are part of the named group.

The following code example downloads a file group named HelpFiles, and displays download progress in a status bar. This example requires that you deploy a Windows Forms application, and that your main form has a StatusStrip control, and a ToolStripStatusLabel control named downloadStatus.

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.");
    }
}

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft