Commit d7beaaee by liulongfei
parents 700300c2 4916b088
using DevExpress.Mvvm.Xpf;
using DevExpress.ClipboardSource.SpreadsheetML;
using DevExpress.Mvvm.Xpf;
using DevExpress.Xpf.Core;
using log4net;
using System;
......@@ -17,6 +18,7 @@ using System.Windows.Forms;
using System.Windows.Shapes;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using static System.Net.WebRequestMethods;
namespace VIZ.Package.Module
......@@ -387,7 +389,7 @@ namespace VIZ.Package.Module
#region 文件列表
private Visibility visibilityList=Visibility.Hidden;
private Visibility visibilityList = Visibility.Hidden;
public Visibility VisibilityList
{
......@@ -690,7 +692,7 @@ namespace VIZ.Package.Module
private void SortFileName()
{
this.FileModels = this.FileModels.OrderBy(a=>a.Name).ToObservableCollection();
this.FileModels = this.FileModels.OrderBy(a => a.Name).ToObservableCollection();
}
#endregion
......@@ -701,7 +703,7 @@ namespace VIZ.Package.Module
private void SortDate()
{
this.FileModels = this.FileModels.OrderBy(a=>Convert.ToDateTime(a.Date)).ToObservableCollection();
this.FileModels = this.FileModels.OrderBy(a => Convert.ToDateTime(a.Date)).ToObservableCollection();
}
#endregion
......@@ -716,7 +718,7 @@ namespace VIZ.Package.Module
public VCommand ExportFolderFilesCommand { get; set; }
private void ExportFolderFiles()
private async void ExportFolderFiles()
{
if (SelectedFolderModel == null || FileModels == null) return;
......@@ -729,12 +731,39 @@ namespace VIZ.Package.Module
string path = ofd.SelectedPath;
foreach (var fileModel in FileModels)
{
string url = string.Format("{0}GetFile?filePath={1}&isResize=false", ApplicationDomainEx.MediaConfig.Url, fileModel.Path);
var fileResult = await MediaResourceFileService.GetImage(url);
string filePath = String.Format("{0}\\{1}", path, fileModel.Name);
if (!File.Exists(filePath))
if (ThumbnailHelper.IsImageByName(fileModel.Name))
{
Image img = Image.FromStream(fileResult);
if (!System.IO.File.Exists(filePath))
{
img.Save(filePath);
}
}
else if (ThumbnailHelper.IsVideo(fileModel.Name))
{
if (!System.IO.File.Exists(filePath))
{
fileModel.OriginThumbnailBitmap.Save(filePath);
FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write);
fileResult.WriteTo(file);
file.Close();
fileResult.Close();
}
}
}
DXMessageBox.Show("素材导出成功");
......@@ -759,28 +788,9 @@ namespace VIZ.Package.Module
public VCommand ExportFileCommand { get; set; }
private void ExprotFile()
private async void ExprotFile()
{
//if (SelectedFileModel == null) return;
//var saveFileDialog1 = new SaveFileDialog
//{
// Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif",
// Title = "Save File"
//};
//saveFileDialog1.ShowDialog();
//if (string.IsNullOrEmpty(saveFileDialog1.FileName)) return;
//Bitmap bitmap = SelectedFileModel.ThumbnailBitmap;
//bitmap.Save(saveFileDialog1.FileName);
//using (var sw = new StreamWriter(selectedFileModel.ThumbnailBitmap))
//{
// sw.Write("Writing Text ");
// sw.WriteLine("Here we go.");
// sw.WriteLine("-------------------");
// sw.Write("Today is is: " + DateTime.Now);
// sw.WriteLine("Done");
//}
if (SelectedFileModel == null) return;
......@@ -789,14 +799,41 @@ namespace VIZ.Package.Module
System.Windows.Forms.FolderBrowserDialog ofd = new System.Windows.Forms.FolderBrowserDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string path = ofd.SelectedPath;
string filePath = String.Format("{0}\\{1}", path, SelectedFileModel.Name);
if (!File.Exists(filePath))
string url = string.Format("{0}GetFile?filePath={1}&isResize=false", ApplicationDomainEx.MediaConfig.Url, SelectedFileModel.Path);
var fileResult = await MediaResourceFileService.GetImage(url);
if (ThumbnailHelper.IsImageByName(SelectedFileModel.Name))
{
Image img = Image.FromStream(fileResult);
if (!System.IO.File.Exists(filePath))
{
SelectedFileModel.OriginThumbnailBitmap.Save(filePath);
img.Save(filePath);
}
}
else if (ThumbnailHelper.IsVideo(SelectedFileModel.Name))
{
if (!System.IO.File.Exists(filePath))
{
FileStream file = new FileStream(filePath, FileMode.Create, FileAccess.Write);
fileResult.WriteTo(file);
file.Close();
fileResult.Close();
}
}
DXMessageBox.Show("素材导出成功");
}
}
......@@ -867,7 +904,7 @@ namespace VIZ.Package.Module
imageEditWindow.ShowDialog();
if(vm.IsEnter)
if (vm.IsEnter)
{
string fileName = string.Format("{0}.png", GenerateStringID());
......@@ -944,9 +981,12 @@ namespace VIZ.Package.Module
var result = await this.mediaResourceFileController.ReStoreRecycFile(SelectedfileRecycleFileModel.Name);
if(result.status=="0")
if (result.status == "0")
{
DXMessageBox.Show("文件还原成功!");
RefreshFile();
RefresRecyclehFile();
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment