本文整理汇总了C#中System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed属性的典型用法代码示例。如果您正苦于以下问题:C# ApplicationDeployment.IsNetworkDeployed属性的具体用法?C# ApplicationDeployment.IsNetworkDeployed怎么用?C# ApplicationDeployment.IsNetworkDeployed使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Deployment.Application.ApplicationDeployment
的用法示例。
在下文中一共展示了ApplicationDeployment.IsNetworkDeployed属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateApplication
private void UpdateApplication()
{
if (ApplicationDeployment.IsNetworkDeployed)
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
ad.CheckForUpdateCompleted += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
ad.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);
ad.CheckForUpdateAsync();
}
}
void ad_CheckForUpdateProgressChanged(object sender, DeploymentProgressChangedEventArgs e)
{
downloadStatus.Text = String.Format("Downloading: {0}. {1:D}K of {2:D}K downloaded.", GetProgressString(e.State), e.BytesCompleted/1024, e.BytesTotal/1024);
}
string GetProgressString(DeploymentProgressState state)
{
if (state == DeploymentProgressState.DownloadingApplicationFiles)
{
return "application files";
}
else if (state == DeploymentProgressState.DownloadingApplicationInformation)
{
return "application manifest";
}
else
{
return "deployment manifest";
}
}
void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show("ERROR: Could not retrieve new version of the application. Reason: \n" + e.Error.Message + "\nPlease report this error to the system administrator.");
return;
}
else if (e.Cancelled == true)
{
MessageBox.Show("The update was cancelled.");
}
// Ask the user if they would like to update the application now.
if (e.UpdateAvailable)
{
sizeOfUpdate = e.UpdateSizeBytes;
if (!e.IsUpdateRequired)
{
DialogResult dr = MessageBox.Show("An update is available. Would you like to update the application now?\n\nEstimated Download Time: ", "Update Available", MessageBoxButtons.OKCancel);
if (DialogResult.OK == dr)
{
BeginUpdate();
}
}
else
{
MessageBox.Show("A mandatory update is available for your application. We will install the update now, after which we will save all of your in-progress data and restart your application.");
BeginUpdate();
}
}
}
开发者ID:.NET开发者,项目名称:System.Deployment.Application,代码行数:65,代码来源:ApplicationDeployment.IsNetworkDeployed