Beispiel #1
0
        //备份
        private void btnBackup_Click(object sender, RoutedEventArgs e)
        {
            if (txtBackupName.Text.Trim() == "")
            {
                MessageBoxTool.ShowConfirmMsgBox("备份名称不能为空,请重新输入!");
                return;
            }
            string fileName = txtBackupName.Text.Trim() + "-" + DateTime.Now.ToString("yyyyMMdd");

            SaveFileDialog ofd = new SaveFileDialog();

            ofd.Title           = "请选择保存文件的路径";
            ofd.DefaultExt      = "zip";
            ofd.FileName        = fileName;
            ofd.OverwritePrompt = true;
            ofd.AddExtension    = true;
            ofd.Filter          = "等速肌力数据库备份文件(*.zip)|*.zip";
            if (ofd.ShowDialog() == true)
            {
                string path = ofd.FileName;
                try
                {
                    CompressProgress progressWindow = new CompressProgress();
                    progressWindow.OutputPath = path;
                    progressWindow.Owner      = Application.Current.MainWindow;
                    progressWindow.ShowDialog();

                    Model.TB_BackupInfo backInfo = new Model.TB_BackupInfo();
                    backInfo.BackupDate = DateTime.Now.ToString("yyyy-MM-dd");
                    backInfo.BackupName = txtBackupName.Text.Trim();
                    backInfo.BackupPath = path;
                    backInfoBLL.Add(backInfo);
                    ReloadData();
                    txtBackupName.Text = "";

                    MessageBoxTool.ShowConfirmMsgBox("备份成功!");
                }
                catch (Exception ee)
                {
                    MessageBoxTool.ShowErrorMsgBox("备份出错,请稍候重试!\r\n" + ee.Message);
                }
            }
        }
Beispiel #2
0
 private void onCompressProgress(int progress)
 {
     CompressProgress?.Invoke(progress);
 }