Beispiel #1
0
        private void CheckUpdate(object parameter)
        {
            EnumCheckFileResult result = EnumCheckFileResult.Ok;

            string sourcePath  = this.InstallPath.Trim();
            string packagePath = this.SetUpPackagePath.Trim();

            this.CheckResult = string.Empty;
            result           = CheckFileUpdate(sourcePath, packagePath);
            if (result == EnumCheckFileResult.Ok)
            {
                MessageBoxHelper.MessageBoxShowSuccess("文件替换成功!请继续核实脚本是否执行成功。");
            }
            else if (result == EnumCheckFileResult.Faild)
            {
                Notice.Show("JieLink软件升级失败", "通知", 3, MessageBoxIcon.Warning);
                UpdateFaildNotify?.Invoke("CheckFiles");
            }
            else if (result == EnumCheckFileResult.Error)
            {
                MessageBoxHelper.MessageBoxShowError("检查升级出错!");
            }
        }
Beispiel #2
0
 private void btnUpdateStepByStep_Click(object sender, RoutedEventArgs e)
 {
     UpdateFaildNotify?.Invoke("CheckFiles");
 }
        private void CheckDBUpdate(object parameter)
        {
            string msg = "";

            try
            {
                string mySqlConnStr = GetConnStr();
                if (string.IsNullOrEmpty(mySqlConnStr))
                {
                    MessageBoxHelper.MessageBoxShowWarning("请输入完整的数据库连接信息");
                    return;
                }
                if (string.IsNullOrEmpty(CheckUpdateContext.SetUpPackagePath))
                {
                    MessageBoxHelper.MessageBoxShowWarning("安装包路径不能为空");
                    return;
                }
                string packagePath = CheckUpdateContext.SetUpPackagePath.Trim();

                packagePath = Path.Combine(packagePath, "DbInitScript");
                var files = from file in Directory.EnumerateFiles(packagePath, "*.json*", SearchOption.TopDirectoryOnly)
                            select file;

                if (files == null || files.Count() == 0)
                {
                    MessageBoxHelper.MessageBoxShowWarning($"未找到数据库对比文件{packagePath}\\xxxxx.json");
                    return;
                }
                string packageDbJsonFile = files.First();
                if (TestMySql(mySqlConnStr))
                {
                    if (CheckDBUpdateTool.CheckDBUpdate(packageDbJsonFile, mySqlConnStr))
                    {
                        MessageBoxHelper.MessageBoxShowSuccess("数据库升级成功!");
                        return;
                    }
                    else
                    {
                        Notice.Show("数据库升级失败", "通知", 3, MessageBoxIcon.Warning);
                        UpdateFaildNotify?.Invoke("CheckScripts");
                    }
                }
            }
            catch (UnauthorizedAccessException)
            {
                msg = "检查升级出错,文件没有访问权限,请设置文件夹读写权限";
            }
            catch (PathTooLongException)
            {
                msg = "检查升级出错,软件安装目录或安装包目录 指定的路径或文件名超过了系统定义的最大长度";
            }
            catch (DirectoryNotFoundException)
            {
                msg = "检查升级出错,所检查的目录不存在";
            }
            catch (Exception ex)
            {
                msg = "程序异常:" + ex.ToString();
            }

            ShowMessage(msg);
            MessageBoxHelper.MessageBoxShowError("检查升级出错!");
        }
Beispiel #4
0
 private void ViewModel_UpdateFaildNotify(string action)
 {
     UpdateFaildNotify?.Invoke(action);
 }
Beispiel #5
0
 private void ViewModel_UpdateFaildNotify(string obj)
 {
     UpdateFaildNotify?.Invoke("CheckScripts");
 }