Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Package
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.Package
Commits
d7beaaee
Commit
d7beaaee
authored
Feb 28, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://49.233.21.66/liulongfei/VIZ.Package
parents
700300c2
4916b088
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
35 deletions
+75
-35
VIZ.Package.Module/Resource/MediaResource/ViewModel/MediaResourcePanelViewModel.cs
+75
-35
No files found.
VIZ.Package.Module/Resource/MediaResource/ViewModel/MediaResourcePanelViewModel.cs
View file @
d7beaaee
using
DevExpress.Mvvm.Xpf
;
using
DevExpress.ClipboardSource.SpreadsheetML
;
using
DevExpress.Mvvm.Xpf
;
using
DevExpress.Xpf.Core
;
using
DevExpress.Xpf.Core
;
using
log4net
;
using
log4net
;
using
System
;
using
System
;
...
@@ -17,6 +18,7 @@ using System.Windows.Forms;
...
@@ -17,6 +18,7 @@ using System.Windows.Forms;
using
System.Windows.Shapes
;
using
System.Windows.Shapes
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Domain
;
using
static
System
.
Net
.
WebRequestMethods
;
namespace
VIZ.Package.Module
namespace
VIZ.Package.Module
...
@@ -183,7 +185,7 @@ namespace VIZ.Package.Module
...
@@ -183,7 +185,7 @@ namespace VIZ.Package.Module
{
{
selectedfileRecycleFileModel
=
value
;
selectedfileRecycleFileModel
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SelectedfileRecycleFileModel
));
this
.
RaisePropertyChanged
(
nameof
(
SelectedfileRecycleFileModel
));
}
}
}
}
...
@@ -387,7 +389,7 @@ namespace VIZ.Package.Module
...
@@ -387,7 +389,7 @@ namespace VIZ.Package.Module
#
region
文件列表
#
region
文件列表
private
Visibility
visibilityList
=
Visibility
.
Hidden
;
private
Visibility
visibilityList
=
Visibility
.
Hidden
;
public
Visibility
VisibilityList
public
Visibility
VisibilityList
{
{
...
@@ -690,7 +692,7 @@ namespace VIZ.Package.Module
...
@@ -690,7 +692,7 @@ namespace VIZ.Package.Module
private
void
SortFileName
()
private
void
SortFileName
()
{
{
this
.
FileModels
=
this
.
FileModels
.
OrderBy
(
a
=>
a
.
Name
).
ToObservableCollection
();
this
.
FileModels
=
this
.
FileModels
.
OrderBy
(
a
=>
a
.
Name
).
ToObservableCollection
();
}
}
#
endregion
#
endregion
...
@@ -701,7 +703,7 @@ namespace VIZ.Package.Module
...
@@ -701,7 +703,7 @@ namespace VIZ.Package.Module
private
void
SortDate
()
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
#
endregion
...
@@ -716,7 +718,7 @@ namespace VIZ.Package.Module
...
@@ -716,7 +718,7 @@ namespace VIZ.Package.Module
public
VCommand
ExportFolderFilesCommand
{
get
;
set
;
}
public
VCommand
ExportFolderFilesCommand
{
get
;
set
;
}
private
void
ExportFolderFiles
()
private
async
void
ExportFolderFiles
()
{
{
if
(
SelectedFolderModel
==
null
||
FileModels
==
null
)
return
;
if
(
SelectedFolderModel
==
null
||
FileModels
==
null
)
return
;
...
@@ -729,12 +731,39 @@ namespace VIZ.Package.Module
...
@@ -729,12 +731,39 @@ namespace VIZ.Package.Module
string
path
=
ofd
.
SelectedPath
;
string
path
=
ofd
.
SelectedPath
;
foreach
(
var
fileModel
in
FileModels
)
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
);
string
filePath
=
String
.
Format
(
"{0}\\{1}"
,
path
,
fileModel
.
Name
);
if
(!
File
.
Exists
(
filePath
))
if
(
ThumbnailHelper
.
IsImageByName
(
fileModel
.
Name
))
{
{
fileModel
.
OriginThumbnailBitmap
.
Save
(
filePath
);
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
))
{
FileStream
file
=
new
FileStream
(
filePath
,
FileMode
.
Create
,
FileAccess
.
Write
);
fileResult
.
WriteTo
(
file
);
file
.
Close
();
fileResult
.
Close
();
}
}
}
}
DXMessageBox
.
Show
(
"素材导出成功"
);
DXMessageBox
.
Show
(
"素材导出成功"
);
...
@@ -759,28 +788,9 @@ namespace VIZ.Package.Module
...
@@ -759,28 +788,9 @@ namespace VIZ.Package.Module
public
VCommand
ExportFileCommand
{
get
;
set
;
}
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
;
if
(
SelectedFileModel
==
null
)
return
;
...
@@ -789,14 +799,41 @@ namespace VIZ.Package.Module
...
@@ -789,14 +799,41 @@ namespace VIZ.Package.Module
System
.
Windows
.
Forms
.
FolderBrowserDialog
ofd
=
new
System
.
Windows
.
Forms
.
FolderBrowserDialog
();
System
.
Windows
.
Forms
.
FolderBrowserDialog
ofd
=
new
System
.
Windows
.
Forms
.
FolderBrowserDialog
();
if
(
ofd
.
ShowDialog
()
==
System
.
Windows
.
Forms
.
DialogResult
.
OK
)
if
(
ofd
.
ShowDialog
()
==
System
.
Windows
.
Forms
.
DialogResult
.
OK
)
{
{
string
path
=
ofd
.
SelectedPath
;
string
path
=
ofd
.
SelectedPath
;
string
filePath
=
String
.
Format
(
"{0}\\{1}"
,
path
,
SelectedFileModel
.
Name
);
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
))
{
img
.
Save
(
filePath
);
}
}
else
if
(
ThumbnailHelper
.
IsVideo
(
SelectedFileModel
.
Name
))
{
{
SelectedFileModel
.
OriginThumbnailBitmap
.
Save
(
filePath
);
if
(!
System
.
IO
.
File
.
Exists
(
filePath
))
{
FileStream
file
=
new
FileStream
(
filePath
,
FileMode
.
Create
,
FileAccess
.
Write
);
fileResult
.
WriteTo
(
file
);
file
.
Close
();
fileResult
.
Close
();
}
}
}
DXMessageBox
.
Show
(
"素材导出成功"
);
DXMessageBox
.
Show
(
"素材导出成功"
);
}
}
}
}
...
@@ -859,7 +896,7 @@ namespace VIZ.Package.Module
...
@@ -859,7 +896,7 @@ namespace VIZ.Package.Module
if
(
selectedFileModel
==
null
||
selectedFileModel
.
ThumbnailBitmap
==
null
)
return
;
if
(
selectedFileModel
==
null
||
selectedFileModel
.
ThumbnailBitmap
==
null
)
return
;
ImageEditWindow
imageEditWindow
=
new
ImageEditWindow
();
ImageEditWindow
imageEditWindow
=
new
ImageEditWindow
();
ImageEditViewModel
vm
=
imageEditWindow
.
ImageCut
.
DataContext
as
ImageEditViewModel
;
ImageEditViewModel
vm
=
imageEditWindow
.
ImageCut
.
DataContext
as
ImageEditViewModel
;
...
@@ -867,7 +904,7 @@ namespace VIZ.Package.Module
...
@@ -867,7 +904,7 @@ namespace VIZ.Package.Module
imageEditWindow
.
ShowDialog
();
imageEditWindow
.
ShowDialog
();
if
(
vm
.
IsEnter
)
if
(
vm
.
IsEnter
)
{
{
string
fileName
=
string
.
Format
(
"{0}.png"
,
GenerateStringID
());
string
fileName
=
string
.
Format
(
"{0}.png"
,
GenerateStringID
());
...
@@ -942,11 +979,14 @@ namespace VIZ.Package.Module
...
@@ -942,11 +979,14 @@ namespace VIZ.Package.Module
{
{
if
(
SelectedfileRecycleFileModel
==
null
)
return
;
if
(
SelectedfileRecycleFileModel
==
null
)
return
;
var
result
=
await
this
.
mediaResourceFileController
.
ReStoreRecycFile
(
SelectedfileRecycleFileModel
.
Name
);
var
result
=
await
this
.
mediaResourceFileController
.
ReStoreRecycFile
(
SelectedfileRecycleFileModel
.
Name
);
if
(
result
.
status
==
"0"
)
if
(
result
.
status
==
"0"
)
{
{
DXMessageBox
.
Show
(
"文件还原成功!"
);
DXMessageBox
.
Show
(
"文件还原成功!"
);
RefreshFile
();
RefresRecyclehFile
();
}
}
else
else
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment