Пример #1
0
        private void ReportExport(ReportVM rvm)
        {
            System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
            saveFileDialog.FileName = rvm.ReportName;
            saveFileDialog.Filter   = "标签模板|*.lbpt";
            if (saveFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            Encoding gbk = Encoding.GetEncoding("gbk");

            ZipStrings.CodePage = gbk.CodePage;
            ZipFile zipFile = ZipFile.Create(saveFileDialog.FileName);

            zipFile.BeginUpdate();
            zipFile.Add(rvm.ReportPath, $"{rvm.Id}.frx");
            zipFile.Add(rvm.DataPath, $"{rvm.Id}.xlsx");
            zipFile.SetComment(JsonConvert.SerializeObject(new Report {
                Id = rvm.Id, ReportName = rvm.ReportName
            }));
            zipFile.CommitUpdate();
            zipFile.Close();

            System.Windows.Forms.MessageBox.Show("导出完成", "提示");
        }
Пример #2
0
 private void ReportNew(ReportVM sourceReport)
 {
     MessengerInstance.Send(
         new CallbackMessage <InputVM>(
             new InputVM {
         Title = "请输入模板名称"
     },
             (msg) => {
         Console.WriteLine("您输入了:" + msg.Text);
         var id = Guid.NewGuid().ToString();
         File.Copy(sourceReport.ReportPath, $"{Funs.ReportsFolder}/{id}.frx");
         File.Copy(sourceReport.DataPath, $"{Funs.ReportsFolder}/{id}.xlsx");
         ReportAdd(id, msg.Text);
     }),
         Notifications.InputShow);
 }
Пример #3
0
        private void ReportRemove(ReportVM rvm)
        {
            if (System.Windows.Forms.MessageBox.Show("确定要删除该模板吗", "询问",
                                                     System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            if (!ReportList.Contains(rvm))
            {
                return;
            }

            ReportList.Remove(rvm);
            File.Delete(rvm.ReportPath);
            File.Delete(rvm.DataPath);
            SaveReportList();

            if (ReportList.Count > 0)
            {
                SelectedReport = ReportList[0];
            }
        }
Пример #4
0
 private void ReportCopy(ReportVM rvm)
 {
     ReportNew(rvm);
 }