Exemplo n.º 1
0
        protected void checkForUpdateThread()
        {
            AppVersionInfo versionInfo = this.getAppVersionInfo(appVersionInfoFile, appId);
            Version        newVersion  = new Version();

            if (versionInfo == null || String.IsNullOrEmpty(versionInfo.version))
            {
                if (updateCheckDone != null)
                {
                    updateCheckDone(UpdateAvailable.Unknown, null);
                }
                return;
            }

            newVersion = new Version(versionInfo.version);
            if (newVersion > currentAppVersion)
            {
                newVersionInfo = versionInfo;
                if (updateCheckDone != null)
                {
                    updateCheckDone(UpdateAvailable.Yes, versionInfo);
                }
            }
            else
            {
                if (updateCheckDone != null)
                {
                    updateCheckDone(UpdateAvailable.No, versionInfo);
                }
            }
        }
Exemplo n.º 2
0
        public IXApplication StartApplication(AppVersionInfo vers, StartupOptions_e opts, CancellationToken cancellationToken)
        {
            var args = new List <string>();

            if (opts.HasFlag(StartupOptions_e.Safe))
            {
                args.Add(SwApplication.CommandLineArguments.SafeMode);
            }

            if (opts.HasFlag(StartupOptions_e.Background))
            {
                args.Add(SwApplication.CommandLineArguments.BackgroundMode);
            }

            if (opts.HasFlag(StartupOptions_e.Silent))
            {
                args.Add(SwApplication.CommandLineArguments.SilentMode);
            }

            var app = SwApplication.Start(((SwAppVersionInfo)vers).Version,
                                          string.Join(" ", args),
                                          cancellationToken);

            app.Sw.CommandInProgress = true;

            return(app);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            StringSingle cmdStr = cmdData.ProtoBufDeserialize <StringSingle>();

            if (Compiled.Debug)
            {
                cmdStr.Debug("=== Support.CheckVersion 上行数据===");
            }

            string         currentVer  = cmdStr.Data;
            AppVersionInfo nextVersion = SupportBiz.GetNextVersion(context.ReqChannel, currentVer);

            if (null == nextVersion)
            {
                context.Flush();
            }
            else
            {
                context.Flush <AppVersion>(nextVersion.ToAppVersion());
            }
        }
Exemplo n.º 4
0
        public ActionResult Edit(AppVersionInfo info)
        {
            AppVersionInfo infoExist = AppVersionBLL.GetList(p => p.Version == info.Version).FirstOrDefault();

            if (infoExist != null && infoExist.ID != info.ID)
            {
                return(Json(new APIJson(-1, "版本已存在")));
            }
            if (string.IsNullOrEmpty(info.Version))
            {
                return(Json(new APIJson(-1, "版本未填写")));
            }
            if (string.IsNullOrEmpty(info.Version.Trim()))
            {
                return(Json(new APIJson(-1, "版本不能是空格,请正确填写")));
            }
            infoExist = AppVersionBLL.GetList(p => p.ID == info.ID).FirstOrDefault();
            if (null == infoExist)
            {
                return(Json(new APIJson(-1, "parms error")));
            }
            infoExist.Version = info.Version;
            infoExist.Detail  = info.Detail;

            if (AppVersionBLL.Edit(infoExist))
            {
                return(Json(new APIJson(0, "提交成功")));
            }
            return(Json(new APIJson(-1, "提交失败")));
        }
Exemplo n.º 5
0
        public ActionResult Edit(int id)
        {
            AppVersionInfo info = AppVersionBLL.GetList(p => p.ID == id).FirstOrDefault();


            return(View(info));
        }
Exemplo n.º 6
0
        public ActionResult Create(AppVersionInfo info)
        {
            if (string.IsNullOrEmpty(info.Version))
            {
                return(Json(new APIJson(-1, "名称未填写")));
            }

            HttpPostedFileBase FileMain = Request.Files["FileMain"];

            if (null == FileMain)
            {
                return(Json(new APIJson(-1, "请选择文件")));
            }
            string FilePathRelative = "/Content/AppVersion/";
            string FileName         = info.Version + ".zip";
            string FileFullPath     = Server.MapPath(FilePathRelative);

            if (!Directory.Exists(FileFullPath))
            {
                Directory.CreateDirectory(FileFullPath);
            }


            FileMain.SaveAs(FileFullPath + FileName);

            info.SRC        = FilePathRelative + FileName;
            info.CreateDate = DateTime.Now;
            AppVersionBLL.Create(info);
            if (info.ID > 0)
            {
                return(Json(new APIJson(0, "添加成功", new { info.ID, info.Version })));
            }
            return(Json(new APIJson(-1, "添加失败")));
        }
Exemplo n.º 7
0
        public FrmVersionInfo(AppVersionInfo appversion, bool showupdate = true)
        {
            InitializeComponent();

            _appversion = appversion;
            _showupdate = showupdate;
        }
Exemplo n.º 8
0
        public static void OpenBrowserWithPrefilledIssue()
        {
            var appVersion = new AppVersionInfo();

            var url = GetUrlForNewBug(string.Format(template, VsVersion.FullVersion, appVersion.BuildVersion, Environment.OSVersion));

            Process.Start(new ProcessStartInfo(url));
        }
Exemplo n.º 9
0
 public SettingsViewModel(
     string targetReadService,
     ImmutableArray <ControllerRouteInfo> routes,
     ConfigurationInfo configurationInfo,
     ImmutableArray <ContainerRegistrationInfo> containerRegistrations,
     IEnumerable <KeyValuePair <string, string> > aspNetConfigurationValues,
     LogEventLevel logEventLevel,
     AppVersionInfo appVersionInfo,
     ImmutableArray <(object, string)> configurationValues,
Exemplo n.º 10
0
        public static int Main(string[] args)
        {
            AppVersionInfo.InitialiseBuildInfoGivenPath(AppDomain.CurrentDomain.BaseDirectory);

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
                         .MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information)
                         .MinimumLevel.Override("System", LogEventLevel.Warning)
                         .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
                         .Enrich.FromLogContext()
                         // uncomment to write to Azure diagnostics stream
                         .WriteTo.File(
                @"D:\home\LogFiles\Application\identityserver.txt",
                fileSizeLimitBytes: 1_000_000,
                rollOnFileSizeLimit: true,
                shared: true,
                flushToDiskInterval: TimeSpan.FromSeconds(1))
                         .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
                         .CreateLogger();

            try
            {
                var seed = args.Contains("/seed");
                if (seed)
                {
                    args = args.Except(new[] { "/seed" }).ToArray();
                }

                var host = CreateHostBuilder(args)
                           .Build();


                if (seed)
                {
                    Log.Information("Seeding database...");
                    var config           = host.Services.GetRequiredService <IConfiguration>();
                    var connectionString = config["SqlConnection"];
                    SeedData.EnsureSeedData(connectionString);
                    Log.Information("Done seeding database.");
                    return(0);
                }

                Log.Information("Starting host...");
                host.Run();
                return(0);
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Host terminated unexpectedly.");
                return(1);
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Exemplo n.º 11
0
        public void AppVersionInfoTest()
        {
            var mockEnvironment = new Mock <IHostEnvironment>();

            mockEnvironment.Setup(m => m.ContentRootPath).Returns("");
            var t = new AppVersionInfo(mockEnvironment.Object);

            Assert.Equal("123456", t.BuildId);
            Assert.Contains(DateTime.UtcNow.ToString("yyyyMMdd"), t.BuildNumber);
            Assert.Equal("LOCALBUILD", t.GitHash);
            Assert.Equal("LBUILD", t.ShortGitHash);
        }
Exemplo n.º 12
0
        /// <summary>
        /// app版本实体
        /// </summary>
        /// <param name="info"> 实体信息</param>
        /// <returns></returns>
        public bool Add(AppVersionInfo info)
        {
            string         postData = JsonHelper.GetJson(info);
            CommonRequest  request  = new CommonRequest();
            CommonResponse response = client.Execute(request, add, postData);

            if (response != null)
            {
                return(response.success);
            }
            return(false);
        }
Exemplo n.º 13
0
    public HomeController(
        CoreServices.IClubService clubService,
        IClubService webClubService,
        IRegattaService regattaService,
        AppVersionInfo versionService)

    {
        _clubservice    = clubService;
        _webClubService = webClubService;
        _regattaService = regattaService;
        _versionService = versionService;
    }
Exemplo n.º 14
0
 public PublicModule(
     CommandService commandService,
     ISubscriberActivitiesRepository activitiesRepository,
     GitHubService gitHubService,
     IServerRepository serverRepository,
     AppVersionInfo appVersionInfo)
 {
     _commandService       = commandService;
     _activitiesRepository = activitiesRepository;
     _githubService        = gitHubService;
     _serverRepository     = serverRepository;
     _appVersionInfo       = appVersionInfo;
 }
        public void VersionInfoShouldNotBeNull()
        {
            AppVersionInfo appVersionInfo = VersionHelper.GetAppVersion();

            _output.WriteLine(appVersionInfo.AssemblyVersion);
            _output.WriteLine(appVersionInfo.FileVersion);
            _output.WriteLine(appVersionInfo.AssemblyFullName);
            _output.WriteLine(appVersionInfo.InformationalVersion);

            Assert.NotNull(appVersionInfo.AssemblyVersion);
            Assert.NotNull(appVersionInfo.FileVersion);
            Assert.NotNull(appVersionInfo.AssemblyFullName);
            Assert.NotNull(appVersionInfo.InformationalVersion);
        }
Exemplo n.º 16
0
        private void ShowCurrentVersion()
        {
            string         strError = string.Empty;
            AppVersionInfo av       = new AppVersionInfo();

            av.AppVersion = Common_Var.AppVersion;
            av.AppName    = Common_Var.SolutionName + ".exe";
            if (!Login_Func.GetAppVersionByVersion(ref av, ref strError))
            {
                MessageBox.Show(strError);
                return;
            }

            using (FrmVersionInfo frm = new FrmVersionInfo(av, false))
            {
                frm.ShowDialog();
            }
        }
Exemplo n.º 17
0
        public async Task <SettingsViewModel> Handle(SettingsViewRequest request, CancellationToken cancellationToken)
        {
            ImmutableArray <ControllerRouteInfo> routesWithController =
                RouteList.GetRoutesWithController(Assemblies.FilteredAssemblies());

            var info = new ConfigurationInfo(_configuration.SourceChain,
                                             _configuration.AllKeys
                                             .OrderBy(item => item)
                                             .Select(item =>
                                                     new ConfigurationKeyInfo(item,
                                                                              _configuration[item],
                                                                              _configuration.ConfiguratorFor(item).GetType().Name))
                                             .ToImmutableArray());

            ImmutableArray <ContainerRegistrationInfo> registrations = _scope.Deepest().Lifetime.ComponentRegistry
                                                                       .Registrations.SelectMany(reg => reg.Services.Select(service =>
                                                                                                                            new ContainerRegistrationInfo(service.Description, reg.Lifetime.ToString()))).ToImmutableArray();

            IEnumerable <KeyValuePair <string, string> > aspNetConfigurationValues = _aspNetConfiguration
                                                                                     .AsEnumerable()
                                                                                     .Where(pair => !string.IsNullOrWhiteSpace(pair.Value))
                                                                                     .Select(pair =>
                                                                                             new KeyValuePair <string, string>(pair.Key,
                                                                                                                               pair.Value.MakeAnonymous(pair.Key, StringExtensions.DefaultAnonymousKeyWords.ToArray())));

            AppVersionInfo appVersionInfo = VersionHelper.GetAppVersion();

            ImmutableArray <(object, string)> configurationValues = _scope.GetConfigurationValues();

            IKeyValueConfiguration applicationMetadata = await GetApplicationMetadataAsync(cancellationToken);

            var settingsViewModel = new SettingsViewModel(
                _deploymentTargetReadService.GetType().Name,
                routesWithController,
                info,
                registrations,
                aspNetConfigurationValues,
                _loggingLevelSwitch.MinimumLevel,
                appVersionInfo,
                configurationValues,
                applicationMetadata);

            return(settingsViewModel);
        }
Exemplo n.º 18
0
        protected AppVersionInfo getAppVersionInfo(String _appVersionXMLUrl, String _appId)
        {
            XmlDocument    document;
            XmlNode        appNode, appVersionNode, appPackageUrlNode, appVersionNameNode;
            AppVersionInfo versionInfo;

            try
            {
                document = new XmlDocument();
                document.Load(_appVersionXMLUrl);

                appNode = document.SelectSingleNode(_appId);
                if (appNode == null)
                {
                    return(null);
                }

                appVersionNode     = appNode.SelectSingleNode("version");
                appVersionNameNode = appNode.SelectSingleNode("name");
                appPackageUrlNode  = appNode.SelectSingleNode("url");

                versionInfo = new AppVersionInfo();

                if (appVersionNode != null)
                {
                    versionInfo.version = appVersionNode.InnerText;
                }
                if (appPackageUrlNode != null)
                {
                    versionInfo.packageUrl = appPackageUrlNode.InnerText;
                }
                if (appVersionNameNode != null)
                {
                    versionInfo.name = appVersionNameNode.InnerText;
                }

                return(versionInfo);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Exemplo n.º 19
0
 /// <summary>
 /// 获取下一个版本信息
 /// </summary>
 /// <param name="channelCode">渠道标识码</param>
 /// <param name="currentVerName">当前版本号</param>
 /// <returns>下一个版本信息</returns>
 public static AppVersionInfo GetNextVersion(string channelCode, string currentVerName)
 {
     using (DbCommander cmd = new DbCommander(DbConn.ReadDb, "SP_Support_GetNextVersion", CommandType.StoredProcedure))
     {
         cmd.AddInputParameters("ChannelCode, VersionName", channelCode, currentVerName);
         AppVersionInfo nextVer = null;
         using (IDataReader reader = cmd.ExecuteReader())
         {
             if (reader.Read())
             {
                 nextVer = new AppVersionInfo
                 {
                     VersionName    = (string)reader["VersionName"],
                     VersionComment = (string)reader["VersionComment"],
                     IsRequired     = (bool)reader["IsRequired"],
                     UpgradeSource  = (int)reader["UpgradeSource"],
                     UpgradePath    = (string)reader["VersionName"]
                 };
             }
             reader.Close();
         }
         return(nextVer);
     }
 }
Exemplo n.º 20
0
 public ActionResult <BuildInfo.BuildInfo> GetBuildInfo()
 {
     return(Ok(AppVersionInfo.GetBuildInfo()));
 }
Exemplo n.º 21
0
 public static bool GetAppVersionByVersion(ref AppVersionInfo appversion, ref string strError)
 {
     return(WMSWebService.service.GetAppVersionByVersion(ref appversion, ref strError));
 }
Exemplo n.º 22
0
 public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
 {
     return(AppVersionInfo.Equals(values[0], values[1]));
 }
Exemplo n.º 23
0
        public async static Task Main(string[] args)
        {
            AppVersionInfo.InitialiseBuildInfoGivenPath(AppDomain.CurrentDomain.BaseDirectory);
            var buildInfo = AppVersionInfo.GetBuildInfo();

            var baseLoggerConfig = new LoggerConfiguration()
                                   .MinimumLevel.Debug()
                                   .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
                                   .MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information)
                                   .MinimumLevel.Override("System", LogEventLevel.Warning)
                                   .MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)

                                   .Enrich.FromLogContext()
                                   .Enrich.WithProperty("ApplicationName", APP_NAME)
                                   .Enrich.WithProperty(nameof(buildInfo.BuildId), buildInfo.BuildId)
                                   .Enrich.WithProperty(nameof(buildInfo.BuildNumber), buildInfo.BuildNumber)
                                   .Enrich.WithProperty(nameof(buildInfo.BranchName), buildInfo.BranchName)
                                   .Enrich.WithProperty(nameof(buildInfo.CommitHash), buildInfo.CommitHash)
                                   .WriteTo.File(
                @"D:\home\LogFiles\Application\webapi.txt",
                fileSizeLimitBytes: 1_000_000,
                rollOnFileSizeLimit: true,
                shared: true,
                flushToDiskInterval: TimeSpan.FromSeconds(1))
                                   .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code);



            try
            {
                var host = CreateHostBuilder(args).Build();
                using (var scope = host.Services.CreateScope())
                {
                    var services      = scope.ServiceProvider;
                    var env           = services.GetService <IWebHostEnvironment>();
                    var configuration = services.GetService <IConfiguration>();
                    if (env.IsProduction() && !string.IsNullOrWhiteSpace(configuration.GetValue <string>("APPINSIGHTS_INSTRUMENTATIONKEY")))
                    {
                        var telemetry = services.GetRequiredService <TelemetryConfiguration>();
                        baseLoggerConfig = baseLoggerConfig.WriteTo.ApplicationInsights(telemetry, TelemetryConverter.Traces);
                    }

                    Log.Logger = baseLoggerConfig.CreateLogger();

                    var logger = services.GetRequiredService <ILogger <Program> >();

                    logger.LogInformation($"BaseDirectory: {AppDomain.CurrentDomain.BaseDirectory}");
                    try
                    {
                        var context = services.GetRequiredService <ApplicationDbContext>();

                        if (context.Database.IsSqlServer())
                        {
                            logger.LogInformation("DataBase migration..");
                            await context.Database.MigrateAsync();

                            logger.LogInformation("DataBase migrated");
                        }

                        logger.LogInformation("DataBase seeding..");
                        await ApplicationDbContextSeed.SeedSampleDataAsync(context);
                    }
                    catch (Exception ex)
                    {
                        logger.LogError(ex, "An error occurred while migrating or seeding the database.");

                        throw;
                    }
                }
                Log.Information("Starting up..");
                await host.RunAsync();
            }
            catch (Exception ex)
            {
                Log.Fatal(ex, "Application start-up failed");
            }
            finally
            {
                Log.CloseAndFlush();
            }
        }
Exemplo n.º 24
0
        protected void checkForUpdateThread()
        {
            AppVersionInfo versionInfo = this.getAppVersionInfo(appVersionInfoFile, appId);
               Version newVersion = new Version();

               if (versionInfo == null || String.IsNullOrEmpty(versionInfo.version))
               {
               if (updateCheckDone != null) updateCheckDone(UpdateAvailable.Unknown, null);
               return;
               }

               newVersion = new Version(versionInfo.version);
               if (newVersion > currentAppVersion)
               {
               newVersionInfo = versionInfo;
               if (updateCheckDone != null) updateCheckDone(UpdateAvailable.Yes, versionInfo);
               }
               else
               {
               if (updateCheckDone != null) updateCheckDone(UpdateAvailable.No, versionInfo);
               }
        }
Exemplo n.º 25
0
        protected AppVersionInfo getAppVersionInfo(String _appVersionXMLUrl, String _appId)
        {
            XmlDocument document;
            XmlNode appNode, appVersionNode, appPackageUrlNode, appVersionNameNode;
            AppVersionInfo versionInfo;

            try
            {
                document = new XmlDocument();
                document.Load(_appVersionXMLUrl);

                appNode = document.SelectSingleNode(_appId);
                if (appNode == null)
                    return null;

                appVersionNode = appNode.SelectSingleNode("version");
                appVersionNameNode = appNode.SelectSingleNode("name");
                appPackageUrlNode = appNode.SelectSingleNode("url");

                versionInfo = new AppVersionInfo();

                if (appVersionNode != null)
                    versionInfo.version = appVersionNode.InnerText;
                if (appPackageUrlNode != null)
                    versionInfo.packageUrl = appPackageUrlNode.InnerText;
                if (appVersionNameNode != null)
                    versionInfo.name = appVersionNameNode.InnerText;

                return versionInfo;
            }
            catch (Exception e)
            {
                return null;
            }
        }
Exemplo n.º 26
0
        private void UpdateApplication()
        {
            try
            {
                AppVersionInfo appVersion = new AppVersionInfo();

                Cursor               = Cursors.WaitCursor;
                txtAccount.Enabled   = false;
                txtPassword.Enabled  = false;
                btnLogin.Enabled     = false;
                this.lblMessage.Text = "正在验证版本......";
                this.lblMessage.Refresh();
                Application.DoEvents();

                appVersion.LocalVersion = Common_Var.AppVersion;
                if (string.IsNullOrEmpty(appVersion.LocalVersion))
                {
                    this.lblMessage.Text = "版本获取错误";
                    this.lblMessage.Refresh();
                    MessageBox.Show(lblMessage.Text, "提示");
                    return;
                }

                appVersion.AppName = Login_Func.GetValue("AppName");
                if (string.IsNullOrEmpty(appVersion.AppName))
                {
                    this.lblMessage.Text = "程序文件名读取失败,请检查Config.xml文件配置";
                    this.lblMessage.Refresh();
                    MessageBox.Show(lblMessage.Text, "提示");
                    return;
                }
                appVersion.FileName = appVersion.AppName;

                AssemblyName an = Assembly.GetExecutingAssembly().GetName();
                appVersion.UpdateAppPath = Path.GetDirectoryName(an.CodeBase.Replace("file:///", "")).ToString() + "\\" + appUpdate;
                if (!File.Exists(appVersion.UpdateAppPath))
                {
                    this.lblMessage.Text = "更新程序不存在,程序将无法自动更新";
                    this.lblMessage.Refresh();
                    MessageBox.Show(lblMessage.Text, "提示");
                    return;
                }

                string filePath = Login_Func.GetValue("UpdateUrl").Trim('/');
                if (string.IsNullOrEmpty(filePath))
                {
                    this.lblMessage.Text = "更新地址读取失败,请检查Config.xml文件配置";
                    this.lblMessage.Refresh();
                    MessageBox.Show(lblMessage.Text, "提示");
                    return;
                }

                int index = filePath.LastIndexOf('/');
                if (index < 0)
                {
                    this.lblMessage.Text = "服务器更新路径格式错误,请检查Config.xml文件配置";
                    this.lblMessage.Refresh();
                    MessageBox.Show(lblMessage.Text, "提示");
                    return;
                }

                appVersion.UpdateUrl = filePath.Substring(index + 1, filePath.Length - index - 1);
                if (string.IsNullOrEmpty(appVersion.UpdateUrl))
                {
                    this.lblMessage.Text = "服务器更新目录获取失败,请检查Config.xml文件配置";
                    this.lblMessage.Refresh();
                    MessageBox.Show(lblMessage.Text, "提示");
                    return;
                }

                string strError = string.Empty;
                if (Login_Func.VerifyAppVersion(ref appVersion, ref strError))
                {
                    if (string.IsNullOrEmpty(appVersion.VersionDesc))
                    {
                        MessageBox.Show(string.Format("程序发现新的版本【{0}】,请确定后更新!", appVersion.AppVersion), "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        System.Diagnostics.Process.Start(appVersion.UpdateAppPath, null);
                    }
                    else
                    {
                        if (MessageBox.Show(string.Format("程序发现新的版本【{0}】,是否查看版本说明?", appVersion.AppVersion), "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            using (FrmVersionInfo frm = new FrmVersionInfo(appVersion))
                            {
                                frm.ShowDialog();
                            }
                        }
                        else
                        {
                            System.Diagnostics.Process.Start(appVersion.UpdateAppPath, null);
                        }
                    }

                    Application.Exit();

                    System.Diagnostics.Process proc = System.Diagnostics.Process.GetCurrentProcess();
                    proc.Kill();
                    return;
                }
                else
                {
                    if (!string.IsNullOrEmpty(strError))
                    {
                        this.lblMessage.Text = strError;
                        this.lblMessage.Refresh();
                        MessageBox.Show(lblMessage.Text, "提示");
                    }
                }

                Application.DoEvents();
            }
            catch (Exception ex)
            {
                this.lblMessage.Text = ex.Message;
                this.lblMessage.Refresh();
                //MessageBox.Show(lblMessage.Text, "错误");
                return;
            }
            finally
            {
                Cursor               = Cursors.Default;
                txtAccount.Enabled   = true;
                txtPassword.Enabled  = true;
                btnLogin.Enabled     = true;
                this.lblMessage.Text = "";
                txtAccount.Focus();
                txtPassword.SelectAll();
                Application.DoEvents();
            }
        }