public  class UpdateChecker {

        public static  event EventHandler completeCheck;
private static bool isChecking = false;
private static WebClient wc;
public static void doUpdateCheck() { if (isChecking) return;
isChecking = true ;
wc = new WebClient();
wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted);
wc.DownloadStringAsync(new Uri("https://files.cnblogs.com/files/wgscd/appupdate.xml"));
} private static void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
try
{
// MessageBox.Show(""+e.Result ,"update",MessageBoxButton.YesNo);
XmlDocument doc = new XmlDocument();
doc.LoadXml("" + e.Result);
string localVar="3.8";//test
string serverVer = doc.SelectSingleNode("app").Attributes["version"].Value;
string serverDate = doc.SelectSingleNode("app").Attributes["update_date"].Value;
string tip = doc.SelectSingleNode("app/tip").InnerText;
if (localVar.CompareTo (serverVer)<0) {
MessageBox.Show("the new version: " + serverVer + "\r\n " + tip + " \r\n update?\r\n", "update", MessageBoxButton.YesNo);
}
if (completeCheck != null) { completeCheck(sender, e); }
isChecking = false;
}
catch { }
wc.DownloadStringCompleted -= new DownloadStringCompletedEventHandler(wc_DownloadStringCompleted); } }

  

c# update check的更多相关文章

  1. 项目中使用了个quartz包,启动时提示Quartz version update check failed

    <span style="font-family: Arial, Helvetica, sans-serif;">2015-09-13 00:12:02 Abstrac ...

  2. Progit Update Check Page

    ######### ######### #########

  3. 提示 npm update check failed

    执行npm命令时出现以下提示 虽然不影响代码运行,但总觉得看了很碍事, 查找资料后发现是因为文件夹权限的问题, .config / configstore文件夹中包含一个文件:update-notif ...

  4. ASP.Net MVC 5 in Xamarin Studio 5.2

    Xamarin Studio 是一个Mono的跨平台 IDE(Integrated Development Environment),支持Wiindow和Mac,最新发布的5.2 版本支持ASP.NE ...

  5. ListView只更新某个item

    方案1:针对需要更新的item调用public View getView(int position, View convertView, ViewGroup parent)即可.如: public c ...

  6. App开发流程之使用分类(Category)和忽略编译警告(Warning)

    Category使得开发过程中,减少了继承的使用,避免子类层级的膨胀.合理使用,可以在不侵入原类代码的基础上,写出漂亮的扩展内容.我更习惯称之为"分类". Category和Ext ...

  7. 回到过去美好的时光——源代码版本管理Always Use source code Control

    Don't Repeat Yourself Don't Repeat Yourself,这是程序员修炼之道中的经典名言.源代码版本管理对程序员来说是非常重要的工作.因为它让你能够回到过去,而不用做重复 ...

  8. Rootkit Hunter恶意程序查杀

    恶意程序,恶意代码检测 下载:https://pkgs.org/search/rkhunter 安装:rpm -ivh rkunter* Installed: #需要先安装  lsof.x86_64 ...

  9. Fiddler源代码分享

    frmViewer.cs: namespace Fiddler{    using Microsoft.Win32;    using System;    using System.Collecti ...

随机推荐

  1. 解决ubuntu 16.04+ Qt 5.7.1无法输入中文的问题

    解决方法: 1.命令行安装fcitx-frontend-qt5 sudo apt-get install fcitx-frontend-qt5 结果显示如下图,说明我的fcitx-frontend-q ...

  2. Python 在子类中调用父类方法详解(单继承、多层继承、多重继承)

    Python 在子类中调用父类方法详解(单继承.多层继承.多重继承)   by:授客 QQ:1033553122   测试环境: win7 64位 Python版本:Python 3.3.5 代码实践 ...

  3. Angular调用父Scope的函数

    app.directive('toggle', function(){ return { restrict: 'A', template: '<a ng-click="f()" ...

  4. LeetCode题解之 Binary Tree Preorder Traversal

    1.题目描述 2.问题分析 利用递归. 3.代码 vector<int> preorderTraversal(TreeNode* root) { vector<int> v; ...

  5. Visual Studio Code配置JavaScript环境

    一·下载并安装Node.js/Visual Studil Code 下载对应你系统的Node.js版本:https://nodejs.org/en/download/ 选安装目录进行安装 环境配置 · ...

  6. SQL Server中事务transaction如果没写在try catch中,就算中间语句报错还是会提交

    假如我们数据库中有两张表Person和Book Person表: CREATE TABLE [dbo].[Person]( ,) NOT NULL, ) NULL, ) NULL, [CreateTi ...

  7. iftop – 实时Linux网络带宽监控工具

    在本文中,我们提出了另一个称为Interface TOP (IFTOP)的优秀程序, 它是一个基于实时控制台的网络带宽监控工具. 它将显示接口上网络活动的快速概览. Iftop 平均每 2,10 和4 ...

  8. Objects聚合分组,统计结果个数(Count)

    参考:http://python.usyiyi.cn/django/topics/db/aggregation.html from django.db.models import Count toda ...

  9. fedora27安装谷歌浏览器Chrome

    安装 添加chrome源 #cd /etc/yum.repos.d #wget http://repo.fdzh.org/chrome/google-chrome-mirrors.repo 安装Chr ...

  10. 修改win下ras/pppoe/l2tp等连接数限制

    最近宽带重新拔号一直不换ip,拔了十几分钟IP仍然不变,想起几年前的pppoe多拔,多拔几个PPPOE占着老IP,再拔新的IP出来用 注册表路径,子项中查看MatchingDeviceId判断协议类型 ...