Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.TVP
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.TVP
Commits
9527fa3e
Commit
9527fa3e
authored
Jan 04, 2023
by
wangonghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
媒体资源添加修改
parent
6c361a41
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
760 additions
and
97 deletions
+760
-97
VIZ.TVP.Domain/Manager/DataBaseManager.cs
+6
-0
VIZ.TVP.Module/Resource/LocalResource/Controller/LocalResourceFile/LocalResourceFileController.cs
+1
-1
VIZ.TVP.Module/Resource/LocalResource/Controller/LocalResourceFile/ThumbnailHelper.cs
+32
-10
VIZ.TVP.Module/Resource/LocalResource/ViewModel/LocalResourceViewModel.cs
+2
-26
VIZ.TVP.Module/Resource/MediaResource/Controller/MediaResourceFile/MediaResourceFileController.cs
+99
-50
VIZ.TVP.Module/Resource/MediaResource/Controller/MediaResourceFile/MediaResourceFileService.cs
+36
-2
VIZ.TVP.Module/Resource/MediaResource/Controller/Model/fileUploadResult.cs
+43
-0
VIZ.TVP.Module/Resource/MediaResource/View/CreateFolder.xaml
+32
-0
VIZ.TVP.Module/Resource/MediaResource/View/CreateFolder.xaml.cs
+31
-0
VIZ.TVP.Module/Resource/MediaResource/View/CreateFolderWindow.xaml
+13
-0
VIZ.TVP.Module/Resource/MediaResource/View/CreateFolderWindow.xaml.cs
+28
-0
VIZ.TVP.Module/Resource/MediaResource/View/MediaResourceView.xaml
+7
-1
VIZ.TVP.Module/Resource/MediaResource/ViewModel/CreateFolderViewModel.cs
+78
-0
VIZ.TVP.Module/Resource/MediaResource/ViewModel/MediaResourceViewModel.cs
+205
-7
VIZ.TVP.Module/Resource/VedioImage/Vedio.jpeg
+0
-0
VIZ.TVP.Module/Setup/Provider/Setup/AppSetup_InitMedia.cs
+54
-0
VIZ.TVP.Module/VIZ.TVP.Module.csproj
+23
-0
VIZ.TVP.Storage/Config/ConfigContext.cs
+54
-0
VIZ.TVP.Storage/VIZ.TVP.Storage.csproj
+1
-0
VIZ.TVP/App.xaml.cs
+4
-0
VIZ.TVP/VIZ.TVP.csproj
+3
-0
VIZ.TVP/config/MediaResouce.config
+8
-0
No files found.
VIZ.TVP.Domain/Manager/DataBaseManager.cs
View file @
9527fa3e
...
@@ -27,6 +27,12 @@ namespace VIZ.TVP.Domain
...
@@ -27,6 +27,12 @@ namespace VIZ.TVP.Domain
/// </summary>
/// </summary>
public
CsvContext
CsvContext
{
get
;
set
;
}
public
CsvContext
CsvContext
{
get
;
set
;
}
/// <summary>
/// 媒体库配置文件
/// </summary>
public
ConfigContext
ConfigContext
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 销毁
/// 销毁
/// </summary>
/// </summary>
...
...
VIZ.TVP.Module/Resource/LocalResource/Controller/LocalResourceFile/LocalResourceFileController.cs
View file @
9527fa3e
...
@@ -74,7 +74,7 @@ namespace VIZ.TVP.Module
...
@@ -74,7 +74,7 @@ namespace VIZ.TVP.Module
}
}
else
if
(
ThumbnailHelper
.
IsVideo
(
fileModel
.
Path
))
else
if
(
ThumbnailHelper
.
IsVideo
(
fileModel
.
Path
))
{
{
string
strVedioPath
=
string
.
Format
(
"{0}{1}"
,
System
.
Environment
.
CurrentDirectory
,
"\\VedioImage\\Vedio.jpeg"
);
string
strVedioPath
=
string
.
Format
(
"{0}{1}"
,
System
.
Environment
.
CurrentDirectory
,
"\\
Resource\\
VedioImage\\Vedio.jpeg"
);
Image
vedioImage
=
Image
.
FromFile
(
strVedioPath
);
Image
vedioImage
=
Image
.
FromFile
(
strVedioPath
);
...
...
VIZ.TVP.Module/Resource/LocalResource/Controller/LocalResourceFile/ThumbnailHelper.cs
View file @
9527fa3e
...
@@ -49,15 +49,6 @@ namespace VIZ.TVP.Module
...
@@ -49,15 +49,6 @@ namespace VIZ.TVP.Module
{
{
try
try
{
{
//string newPath = "";
//if (File.Exists(Application.StartupPath + path))
//{
// newPath = Application.StartupPath + path;
//}
//else
//{//如果图片不存在,使用默认图片
// //newPath = Application.StartupPath + LocalConfig.defaultPicPath;
//}
FileStream
fs
=
new
FileStream
(
path
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
ReadWrite
);
FileStream
fs
=
new
FileStream
(
path
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
ReadWrite
);
Image
result
=
Image
.
FromStream
(
fs
);
Image
result
=
Image
.
FromStream
(
fs
);
fs
.
Close
();
fs
.
Close
();
...
@@ -88,8 +79,13 @@ namespace VIZ.TVP.Module
...
@@ -88,8 +79,13 @@ namespace VIZ.TVP.Module
return
false
;
return
false
;
}
}
}
}
public
static
Boolean
IsImageByName
(
string
name
)
public
static
Boolean
IsImageByName
(
string
name
)
{
{
try
{
if
(
name
==
null
)
return
false
;
int
pos
=
name
.
LastIndexOf
(
"."
);
int
pos
=
name
.
LastIndexOf
(
"."
);
if
(
name
.
Length
-
pos
-
1
<
3
)
if
(
name
.
Length
-
pos
-
1
<
3
)
return
false
;
return
false
;
...
@@ -99,6 +95,12 @@ namespace VIZ.TVP.Module
...
@@ -99,6 +95,12 @@ namespace VIZ.TVP.Module
return
IsInIgnoreCase
(
ext
,
imge
);
return
IsInIgnoreCase
(
ext
,
imge
);
}
}
catch
(
Exception
e
)
{
return
false
;
}
}
private
static
bool
IsInIgnoreCase
(
string
source
,
params
string
[]
list
)
private
static
bool
IsInIgnoreCase
(
string
source
,
params
string
[]
list
)
{
{
...
@@ -159,10 +161,30 @@ namespace VIZ.TVP.Module
...
@@ -159,10 +161,30 @@ namespace VIZ.TVP.Module
return
isVideo
;
return
isVideo
;
}
}
#
endregion
/// <summary>
/// 从完整路径中查找文件或文件夹名称
/// </summary>
/// <param name="path">完整路径</param>
/// <returns></returns>
public
static
string
GetFileFolderName
(
string
path
)
{
// 如果没有路径,则返回空
if
(
string
.
IsNullOrEmpty
(
path
))
return
string
.
Empty
;
// 使所有斜杠成反斜杠
var
normalizedPath
=
path
.
Replace
(
'/'
,
'\\'
);
// 找到最后一个反斜杠就是路径
var
lastIndex
=
normalizedPath
.
LastIndexOf
(
'\\'
);
// 如果找不到反斜线,则返回路径本身
if
(
lastIndex
<=
0
)
return
path
;
// 最后一个反斜杠后返回名称
return
path
.
Substring
(
lastIndex
+
1
);
}
#
endregion
}
}
}
}
VIZ.TVP.Module/Resource/LocalResource/ViewModel/LocalResourceViewModel.cs
View file @
9527fa3e
...
@@ -273,30 +273,6 @@ namespace VIZ.TVP.Module
...
@@ -273,30 +273,6 @@ namespace VIZ.TVP.Module
#
endregion
#
endregion
/// <summary>
/// 从完整路径中查找文件或文件夹名称
/// </summary>
/// <param name="path">完整路径</param>
/// <returns></returns>
public
static
string
GetFileFolderName
(
string
path
)
{
// 如果没有路径,则返回空
if
(
string
.
IsNullOrEmpty
(
path
))
return
string
.
Empty
;
// 使所有斜杠成反斜杠
var
normalizedPath
=
path
.
Replace
(
'/'
,
'\\'
);
// 找到最后一个反斜杠就是路径
var
lastIndex
=
normalizedPath
.
LastIndexOf
(
'\\'
);
// 如果找不到反斜线,则返回路径本身
if
(
lastIndex
<=
0
)
return
path
;
// 最后一个反斜杠后返回名称
return
path
.
Substring
(
lastIndex
+
1
);
}
...
@@ -369,7 +345,7 @@ namespace VIZ.TVP.Module
...
@@ -369,7 +345,7 @@ namespace VIZ.TVP.Module
{
{
selectedFolderModel
.
Children
.
Add
(
new
LFResourceFolderModel
()
selectedFolderModel
.
Children
.
Add
(
new
LFResourceFolderModel
()
{
{
Name
=
GetFileFolderName
(
directoryPath
),
Name
=
ThumbnailHelper
.
GetFileFolderName
(
directoryPath
),
Path
=
directoryPath
,
Path
=
directoryPath
,
FolderType
=
ResourceFolderType
.
Folder
FolderType
=
ResourceFolderType
.
Folder
});
});
...
@@ -446,7 +422,7 @@ namespace VIZ.TVP.Module
...
@@ -446,7 +422,7 @@ namespace VIZ.TVP.Module
Files
.
ForEach
(
filePath
=>
Files
.
ForEach
(
filePath
=>
{
{
var
ghFileModel
=
new
LFResourceFileModel
();
var
ghFileModel
=
new
LFResourceFileModel
();
ghFileModel
.
Name
=
GetFileFolderName
(
filePath
);
ghFileModel
.
Name
=
ThumbnailHelper
.
GetFileFolderName
(
filePath
);
ghFileModel
.
Path
=
filePath
;
ghFileModel
.
Path
=
filePath
;
files
.
Add
(
ghFileModel
);
files
.
Add
(
ghFileModel
);
...
...
VIZ.TVP.Module/Resource/MediaResource/Controller/MediaResourceFile/MediaResourceFileController.cs
View file @
9527fa3e
using
log4net
;
using
DevExpress.Internal.WinApi.Windows.UI.Notifications
;
using
log4net
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Configuration
;
using
System.Drawing
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.Drawing.Imaging
;
using
System.IO
;
using
System.IO
;
...
@@ -9,8 +11,10 @@ using System.Net.Http;
...
@@ -9,8 +11,10 @@ using System.Net.Http;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Web
;
using
System.Web
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.TVP.Domain
;
using
VIZ.TVP.Domain
;
using
VIZ.TVP.Module.Resource.MediaResource.Controller.Model
;
using
VIZ.TVP.Service
;
using
VIZ.TVP.Service
;
using
VIZ.TVP.Storage
;
using
VIZ.TVP.Storage
;
...
@@ -23,6 +27,11 @@ namespace VIZ.TVP.Module
...
@@ -23,6 +27,11 @@ namespace VIZ.TVP.Module
/// </summary>
/// </summary>
private
static
readonly
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
VizResourceFileController
));
private
static
readonly
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
VizResourceFileController
));
public
static
AppSettingsSection
config
=
ApplicationDomainEx
.
DataBaseManager
.
ConfigContext
.
configuration
.
AppSettings
;
private
static
string
httpUrl
=
config
.
Settings
[
"url"
].
Value
.
ToString
();
/// <summary>
/// <summary>
/// VIZ资源缩略图控制器
/// VIZ资源缩略图控制器
/// </summary>
/// </summary>
...
@@ -59,77 +68,56 @@ namespace VIZ.TVP.Module
...
@@ -59,77 +68,56 @@ namespace VIZ.TVP.Module
return
;
return
;
}
}
//GH_Link_Node link_related = folder.EntryNode.links.FirstOrDefault(p => p.rel == GH_Link_Rel_Enums.related);
//if (link_related == null || string.IsNullOrWhiteSpace(link_related.href))
//{
// folder.IsRefreshedFiles = true;
// return;
//}
//this.Support.IsFileLoading = true;
//ThreadHelper.SafeRun(() =>
//{
// List<GHResourceFileModel> files = ghResourceService.GetGHResourceFiles(link_related.href, folder);
// WPFHelper.BeginInvoke(() =>
// {
// folder.Files = files.ToObservableCollection();
// this.Support.FileModels = folder.Files;
// folder.IsRefreshedFiles = true;
// this.Support.IsFileLoading = false;
// // 开始下载缩略图
// this.BeginDownloadThumbnail(folder);
// });
//});
//
WPFHelper
.
BeginInvoke
(
async
()
=>
WPFHelper
.
BeginInvoke
(
async
()
=>
{
{
string
header
=
string
.
Format
(
"http://192.168.3.76:9000/api/home/GetListFile?filePath={0}"
,
folder
.
Path
);
string
header
=
string
.
Format
(
"{0}GetListFile?filePath={1}"
,
httpUrl
,
folder
.
Path
);
var
FileResult
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
header
,
""
);
var
FileResult
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
header
,
""
);
List
<
MHResourceFileModel
>
list
=
new
List
<
MHResourceFileModel
>();
List
<
MHResourceFileModel
>
list
=
new
List
<
MHResourceFileModel
>();
// folder.Files = new System.Collections.ObjectModel.ObservableCollection<GHResourceFileModel>();
// folder.Files = new System.Collections.ObjectModel.ObservableCollection<GHResourceFileModel>();
foreach
(
var
file
in
FileResult
.
masterData
)
foreach
(
var
file
in
FileResult
.
masterData
)
{
{
try
{
MHResourceFileModel
GHFile
=
new
MHResourceFileModel
();
MHResourceFileModel
GHFile
=
new
MHResourceFileModel
();
if
(
ThumbnailHelper
.
IsImageByName
(
file
.
fileName
))
GHFile
.
Name
=
file
.
fileName
;
GHFile
.
Path
=
file
.
smallIconUrl
;
if
(
ThumbnailHelper
.
IsImageByName
(
GHFile
.
Name
))
{
{
//GetFile
//GetFile
GHFile
.
Name
=
file
.
fileName
;
string
url
=
string
.
Format
(
"http://192.168.3.76:9000/api/home/GetFile?filePath={0}"
,
GHFile
.
Path
)
;
GHFile
.
Path
=
file
.
smallIconUrl
;
string
url
=
string
.
Format
(
"{0}GetFile?filePath={1}"
,
httpUrl
,
GHFile
.
Path
);
var
fileResult
=
await
MediaResourceFileService
.
GetImage
(
url
);
var
fileResult
=
await
MediaResourceFileService
.
GetImage
(
url
);
GHFile
.
FileType
=
ResourceFileType
.
IMAGE
;
GHFile
.
FileType
=
ResourceFileType
.
IMAGE
;
Image
img
=
Bitmap
.
FromStream
(
fileResult
);
Image
img
=
Bitmap
.
FromStream
(
fileResult
);
Bitmap
bmp
=
new
Bitmap
(
img
);
img
=
ThumbnailHelper
.
GetThumbnail
(
img
,
100
,
200
);
Bitmap
bmp
=
new
Bitmap
(
img
);
GHFile
.
ThumbnailBitmap
=
bmp
;
GHFile
.
ThumbnailBitmap
=
bmp
;
list
.
Add
(
GHFile
);
}
}
else
if
(
ThumbnailHelper
.
IsVideo
(
GHFile
.
Name
))
else
if
(
ThumbnailHelper
.
IsVideo
(
file
.
file
Name
))
{
{
string
strVedioPath
=
string
.
Format
(
"{0}{1}"
,
System
.
Environment
.
CurrentDirectory
,
"\\VedioImage\\Vedio.jpeg"
);
GHFile
.
Name
=
file
.
fileName
;
GHFile
.
Path
=
file
.
smallIconUrl
;
string
strVedioPath
=
string
.
Format
(
"{0}{1}"
,
System
.
Environment
.
CurrentDirectory
,
"\\Resource\\VedioImage\\Vedio.jpeg"
);
Image
vedioImage
=
Image
.
FromFile
(
strVedioPath
);
Image
vedioImage
=
Image
.
FromFile
(
strVedioPath
);
vedioImage
=
ThumbnailHelper
.
GetThumbnail
(
vedioImage
,
100
,
200
);
Bitmap
vedioBtm
=
new
Bitmap
(
vedioImage
);
Bitmap
vedioBtm
=
new
Bitmap
(
vedioImage
);
GHFile
.
ThumbnailBitmap
=
vedioBtm
;
GHFile
.
ThumbnailBitmap
=
vedioBtm
;
GHFile
.
FileType
=
ResourceFileType
.
Video
;
GHFile
.
FileType
=
ResourceFileType
.
Video
;
}
list
.
Add
(
GHFile
);
list
.
Add
(
GHFile
);
}
}
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
.
Message
);
}
}
folder
.
Files
=
list
.
ToObservableCollection
();
folder
.
Files
=
list
.
ToObservableCollection
();
...
@@ -137,11 +125,69 @@ namespace VIZ.TVP.Module
...
@@ -137,11 +125,69 @@ namespace VIZ.TVP.Module
});
});
}
}
//string oldFile, string newFile
public
async
void
MoveFile
(
string
oldPath
,
string
newPath
)
{
string
header
=
string
.
Format
(
"{0}MoveFile?oldFile={1}&newFile={2}"
,
httpUrl
,
oldPath
,
newPath
);
var
errorMessage
=
await
MediaResourceFileService
.
PostAsyncJson
(
header
,
""
);
}
/// <summary>
/// 添加文件夹
/// </summary>
/// <param name="path"></param>
public
async
void
CreateFolder
(
string
path
)
{
string
header
=
string
.
Format
(
"{0}CreateFiles?newDir={1}"
,
httpUrl
,
path
);
var
strError
=
await
MediaResourceFileService
.
PostAsyncJson
(
header
,
""
);
}
/// <summary>
/// 删除文件夹
/// </summary>
/// <param name="path"></param>
public
async
void
DeleteFolder
(
string
path
)
{
string
header
=
string
.
Format
(
"{0}DeleteFiles?delDir={1}"
,
httpUrl
,
path
);
var
strError
=
await
MediaResourceFileService
.
PostAsyncJson
(
header
,
""
);
}
/// <summary>
/// 创建文件
/// </summary>
/// <param name="filePath"></param>
/// <param name="fileName"></param>
/// <returns></returns>
public
async
Task
<
fileUploadResult
>
CreateFile
(
string
filePath
,
string
fileName
)
{
string
requestUri
=
string
.
Format
(
"{0}UplodFile?filePath={1}"
,
httpUrl
,
this
.
Support
.
SelectedFolderModel
.
Path
+
"\\"
);
fileUploadResult
upLoadResult
=
await
MediaResourceFileService
.
PostImage
<
fileUploadResult
>(
requestUri
,
filePath
,
fileName
);
return
upLoadResult
;
}
public
async
void
DeleteFile
(
string
path
)
{
string
header
=
string
.
Format
(
"{0}DeleteFile?delFile={1}"
,
httpUrl
,
path
);
var
strError
=
await
MediaResourceFileService
.
PostAsyncJson
(
header
,
""
);
}
/// <summary>
///获取文件
/// </summary>
/// <returns></returns>
public
async
Task
<
List
<
MHResourceFolderModel
>>
GetMeiaResourceFolder
()
public
async
Task
<
List
<
MHResourceFolderModel
>>
GetMeiaResourceFolder
()
{
{
var
folderResult
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
"http://192.168.3.76:9000/api/home/GetListFiles"
,
""
);
// var config =
var
folderResult
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
string
.
Format
(
"{0}GetListFiles"
,
httpUrl
),
""
);
if
(
folderResult
==
null
)
if
(
folderResult
==
null
)
return
null
;
return
null
;
...
@@ -150,14 +196,18 @@ namespace VIZ.TVP.Module
...
@@ -150,14 +196,18 @@ namespace VIZ.TVP.Module
}
}
/// <summary>
/// 获取文件夹
/// </summary>
/// <param name="foldersDatas"></param>
/// <returns></returns>
private
List
<
MHResourceFolderModel
>
GetFolder
(
List
<
ms
>
foldersDatas
)
private
List
<
MHResourceFolderModel
>
GetFolder
(
List
<
ms
>
foldersDatas
)
{
{
List
<
MHResourceFolderModel
>
listFolderModel
=
new
List
<
MHResourceFolderModel
>();
List
<
MHResourceFolderModel
>
listFolderModel
=
new
List
<
MHResourceFolderModel
>();
foreach
(
var
floderData
in
foldersDatas
)
foreach
(
var
floderData
in
foldersDatas
)
{
{
if
(
floderData
.
fileType
==
"floder"
)
if
(
floderData
.
fileType
==
"floder"
)
{
{
MHResourceFolderModel
child
=
new
MHResourceFolderModel
();
MHResourceFolderModel
child
=
new
MHResourceFolderModel
();
child
.
Name
=
floderData
.
fileName
;
child
.
Name
=
floderData
.
fileName
;
...
@@ -166,7 +216,6 @@ namespace VIZ.TVP.Module
...
@@ -166,7 +216,6 @@ namespace VIZ.TVP.Module
List
<
MHResourceFolderModel
>
children_list
=
GetFolder
(
floderData
.
m
);
List
<
MHResourceFolderModel
>
children_list
=
GetFolder
(
floderData
.
m
);
foreach
(
MHResourceFolderModel
item
in
children_list
)
foreach
(
MHResourceFolderModel
item
in
children_list
)
{
{
...
...
VIZ.TVP.Module/Resource/MediaResource/Controller/MediaResourceFile/MediaResourceFileService.cs
View file @
9527fa3e
...
@@ -7,6 +7,7 @@ using System.Linq;
...
@@ -7,6 +7,7 @@ using System.Linq;
using
System.Net.Http
;
using
System.Net.Http
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Web.UI.WebControls
;
namespace
VIZ.TVP.Module
namespace
VIZ.TVP.Module
{
{
...
@@ -36,9 +37,9 @@ namespace VIZ.TVP.Module
...
@@ -36,9 +37,9 @@ namespace VIZ.TVP.Module
return
responseBody
;
return
responseBody
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
log
.
Error
(
string
.
Format
(
"{0}_{1}"
,
"获取媒体资源文件夹"
,
ex
.
ToString
()));
log
.
Error
(
string
.
Format
(
"{0}_{1}"
,
"获取媒体资源文件夹"
,
ex
.
ToString
()));
return
""
;
return
""
;
}
}
...
@@ -162,6 +163,39 @@ namespace VIZ.TVP.Module
...
@@ -162,6 +163,39 @@ namespace VIZ.TVP.Module
}
}
/// <summary>
/// 上传图片
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="requestUri"></param>
/// <param name="path"></param>
/// <param name="fileName"></param>
/// <returns></returns>
public
static
async
Task
<
T
>
PostImage
<
T
>(
string
requestUri
,
string
path
,
string
fileName
)
{
HttpClient
client
=
new
HttpClient
();
var
content
=
new
MultipartFormDataContent
();
content
.
Headers
.
Add
(
"ContentType"
,
$"multipart/form-data"
);
//添加字符串参数,参数名为qq
// content.Add(new StringContent("123456"), "qq");
//string path = Path.Combine(System.Environment.CurrentDirectory, "1.png");
//添加文件参数,参数名为files,文件名为123.png
var
b
=
new
ByteArrayContent
(
System
.
IO
.
File
.
ReadAllBytes
(
path
));
content
.
Add
(
new
ByteArrayContent
(
System
.
IO
.
File
.
ReadAllBytes
(
path
)),
"image"
,
fileName
);
var
response
=
await
client
.
PostAsync
(
requestUri
,
content
);
var
result
=
response
.
Content
.
ReadAsStringAsync
().
Result
;
return
JsonConvert
.
DeserializeObject
<
T
>(
result
);
}
}
}
}
}
VIZ.TVP.Module/Resource/MediaResource/Controller/Model/fileUploadResult.cs
0 → 100644
View file @
9527fa3e
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.TVP.Module.Resource.MediaResource.Controller.Model
{
public
class
fileUploadResult
{
/// <summary>
/// 状态码:0-成功
/// </summary>
public
string
errCode
{
get
;
set
;
}
/// <summary>
/// 状态描述:0-成功
/// </summary>
public
string
message
{
get
;
set
;
}
/// <summary>
/// 状态描述:0-success
/// </summary>
public
string
status
{
get
;
set
;
}
/// <summary>
/// 设置文件信息
/// </summary>
public
ms
masterData
=
new
ms
();
}
}
VIZ.TVP.Module/Resource/MediaResource/View/CreateFolder.xaml
0 → 100644
View file @
9527fa3e
<UserControl x:Class="VIZ.TVP.Module.CreateFolder"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
d:DataContext="{d:DesignInstance Type=local:CreateProjectViewModel}"
d:Background="White"
xmlns:local="clr-namespace:VIZ.TVP.Module"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="400">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="文件名:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<TextBox Text="{Binding Path=FolderName}" Grid.Column="1" VerticalAlignment="Center" VerticalContentAlignment="Center"
AcceptsReturn="False" TextWrapping="NoWrap" Height="30" Margin="10,0,10,0"></TextBox>
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="确定" Width="80" Height="30" Margin="10" Command="{Binding EnterCommand}"></Button>
<Button Content="取消" Width="80" Height="30" Margin="10" Command="{Binding CancelCommand}"></Button>
</StackPanel>
</Grid>
</UserControl>
VIZ.TVP.Module/Resource/MediaResource/View/CreateFolder.xaml.cs
0 → 100644
View file @
9527fa3e
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
VIZ.Framework.Core
;
namespace
VIZ.TVP.Module
{
/// <summary>
/// Interaction logic for CreateFolder.xaml
/// </summary>
public
partial
class
CreateFolder
:
UserControl
{
public
CreateFolder
()
{
InitializeComponent
();
WPFHelper
.
BindingViewModel
(
this
,
new
CreateFolderViewModel
());
}
}
}
VIZ.TVP.Module/Resource/MediaResource/View/CreateFolderWindow.xaml
0 → 100644
View file @
9527fa3e
<dx:ThemedWindow
x:Class="VIZ.TVP.Module.CreateFolderWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:module="clr-namespace:VIZ.TVP.Module"
Title="创建文件夹" Height="240" Width="400" WindowStartupLocation="CenterScreen" WindowStyle="None" >
<Grid>
<module:CreateFolder x:Name="createFolderView"></module:CreateFolder>
</Grid>
</dx:ThemedWindow>
VIZ.TVP.Module/Resource/MediaResource/View/CreateFolderWindow.xaml.cs
0 → 100644
View file @
9527fa3e
using
DevExpress.Xpf.Core
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Shapes
;
namespace
VIZ.TVP.Module
{
/// <summary>
/// Interaction logic for CreateFolderWindow.xaml
/// </summary>
public
partial
class
CreateFolderWindow
:
ThemedWindow
{
public
CreateFolderWindow
()
{
InitializeComponent
();
}
}
}
VIZ.TVP.Module/Resource/MediaResource/View/MediaResourceView.xaml
View file @
9527fa3e
...
@@ -46,6 +46,9 @@
...
@@ -46,6 +46,9 @@
<dxg:TreeViewControl.ContextMenu>
<dxg:TreeViewControl.ContextMenu>
<ContextMenu>
<ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFolderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFolderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="创建文件夹" Command="{Binding Path=PlacementTarget.DataContext.CreateFloderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="删除文件夹" Command="{Binding Path=PlacementTarget.DataContext.DeleteFloderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="移入文件夹" Command="{Binding Path=PlacementTarget.DataContext.MoveFloderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</ContextMenu>
</dxg:TreeViewControl.ContextMenu>
</dxg:TreeViewControl.ContextMenu>
<dxmvvm:Interaction.Behaviors>
<dxmvvm:Interaction.Behaviors>
...
@@ -112,8 +115,11 @@
...
@@ -112,8 +115,11 @@
<dxmvvm:EventToCommand EventName="Opened" Command="{Binding Path=FileContextMenuOpendCommand}"></dxmvvm:EventToCommand>
<dxmvvm:EventToCommand EventName="Opened" Command="{Binding Path=FileContextMenuOpendCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</dxmvvm:Interaction.Behaviors>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="添加文件" Command="{Binding Path=PlacementTarget.DataContext.CreateFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="删除文件" Command="{Binding Path=PlacementTarget.DataContext.DeleteFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="移动文件" Command="{Binding Path=PlacementTarget.DataContext.MoveFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<Separator/>
<Separator/>
<
MenuItem Header="添加至场景模板" Command="{Binding Path=PlacementTarget.DataContext.AddProgramTemplateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/
>
<
!--<MenuItem Header="添加至场景模板" Command="{Binding Path=PlacementTarget.DataContext.AddProgramTemplateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>--
>
<MenuItem Header="复制路径" Command="{Binding Path=PlacementTarget.DataContext.CopyFilePathCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="复制路径" Command="{Binding Path=PlacementTarget.DataContext.CopyFilePathCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</ContextMenu>
</dxg:GridControl.ContextMenu>
</dxg:GridControl.ContextMenu>
...
...
VIZ.TVP.Module/Resource/MediaResource/ViewModel/CreateFolderViewModel.cs
0 → 100644
View file @
9527fa3e
using
DevExpress.Data.Mask.Internal
;
using
DevExpress.Xpf.Core
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Plugin
;
namespace
VIZ.TVP.Module
{
public
class
CreateFolderViewModel
:
PluginViewModelBase
{
public
CreateFolderViewModel
()
{
EnterCommand
=
new
VCommand
(
Enter
);
CancelCommand
=
new
VCommand
(
Cancel
);
}
private
string
folderName
;
public
string
FolderName
{
get
{
return
folderName
;
}
set
{
folderName
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
FolderName
));
}
}
private
bool
isEnter
;
/// <summary>
/// 是否确定
/// </summary>
public
bool
IsEnter
{
get
{
return
isEnter
;
}
set
{
isEnter
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
IsEnter
));
}
}
public
VCommand
EnterCommand
{
get
;
set
;
}
public
VCommand
CancelCommand
{
get
;
set
;
}
/// <summary>
/// 确定
/// </summary>
private
void
Enter
()
{
if
(
string
.
IsNullOrWhiteSpace
(
this
.
FolderName
))
{
DXMessageBox
.
Show
(
"请输入文件名"
);
return
;
}
this
.
IsEnter
=
true
;
this
.
GetWindow
()?.
Close
();
}
/// <summary>
/// 取消
/// </summary>
private
void
Cancel
()
{
this
.
IsEnter
=
false
;
this
.
GetWindow
()?.
Close
();
}
public
override
void
Dispose
()
{
}
}
}
VIZ.TVP.Module/Resource/MediaResource/ViewModel/MediaResourceViewModel.cs
View file @
9527fa3e
using
DevExpress.Mvvm.POCO
;
using
DevExpress.Mvvm.POCO
;
using
DevExpress.Mvvm.UI.Native.ViewGenerator
;
using
DevExpress.Mvvm.UI.Native.ViewGenerator
;
using
DevExpress.Mvvm.Xpf
;
using
DevExpress.Mvvm.Xpf
;
using
DevExpress.Utils.CommonDialogs.Internal
;
using
DevExpress.Xpf.Core
;
using
DevExpress.Xpf.Core.Native
;
using
DevExpress.Xpf.Core.Native
;
using
DevExpress.XtraPrinting.Native
;
using
DevExpress.XtraPrinting.Native
;
using
log4net
;
using
log4net
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.Configuration
;
using
System.Drawing
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -17,13 +21,14 @@ using VIZ.Framework.Plugin;
...
@@ -17,13 +21,14 @@ using VIZ.Framework.Plugin;
using
VIZ.TVP.Domain
;
using
VIZ.TVP.Domain
;
using
VIZ.TVP.Service
;
using
VIZ.TVP.Service
;
using
VIZ.TVP.Storage
;
using
VIZ.TVP.Storage
;
using
static
System
.
Windows
.
Forms
.
VisualStyles
.
VisualStyleElement
;
namespace
VIZ.TVP.Module
namespace
VIZ.TVP.Module
{
{
/// <summary>
/// <summary>
/// 媒体资源视图模型
/// 媒体资源视图模型
/// </summary>
/// </summary>
public
class
MediaResourceViewModel
:
PluginViewModelBase
,
IMediaResourceFileSupport
public
class
MediaResourceViewModel
:
PluginViewModelBase
,
IMediaResourceFileSupport
{
{
/// <summary>
/// <summary>
...
@@ -46,8 +51,18 @@ namespace VIZ.TVP.Module
...
@@ -46,8 +51,18 @@ namespace VIZ.TVP.Module
private
void
initCommand
()
private
void
initCommand
()
{
{
this
.
LoadedCommand
=
new
VCommand
(
this
.
Loaded
);
this
.
LoadedCommand
=
new
VCommand
(
this
.
Loaded
);
this
.
RefreshFolderCommand
=
new
VCommand
(
this
.
RefreshFolder
);
this
.
RefreshFolderCommand
=
new
VCommand
(
this
.
RefreshFolder
);
this
.
RefreshFileCommand
=
new
VCommand
(
this
.
RefreshFile
);
this
.
RefreshFileCommand
=
new
VCommand
(
this
.
RefreshFile
);
this
.
CreateFloderCommand
=
new
VCommand
(
this
.
CreateFloder
);
this
.
DeleteFloderCommand
=
new
VCommand
(
this
.
DeleteFloder
);
this
.
CreateFileCommand
=
new
VCommand
(
this
.
CreateFile
);
this
.
DeleteFileCommand
=
new
VCommand
(
this
.
DeleteFile
);
this
.
MoveFileCommand
=
new
VCommand
(
this
.
MoveFile
);
this
.
MoveFloderCommand
=
new
VCommand
(
this
.
MoveFileFloder
);
this
.
FolderExpandCommand
=
new
VCommand
<
DevExpress
.
Xpf
.
Grid
.
TreeList
.
NodeDoubleClickEventArgs
>(
this
.
FolderExpand
);
this
.
FolderExpandCommand
=
new
VCommand
<
DevExpress
.
Xpf
.
Grid
.
TreeList
.
NodeDoubleClickEventArgs
>(
this
.
FolderExpand
);
this
.
FileFilterCommand
=
new
VCommand
<
ResourceFileType
>(
this
.
FileFilter
);
this
.
FileFilterCommand
=
new
VCommand
<
ResourceFileType
>(
this
.
FileFilter
);
this
.
FileRowFilterCommand
=
new
DevExpress
.
Mvvm
.
DelegateCommand
<
RowFilterArgs
>(
this
.
FileRowFilter
);
this
.
FileRowFilterCommand
=
new
DevExpress
.
Mvvm
.
DelegateCommand
<
RowFilterArgs
>(
this
.
FileRowFilter
);
...
@@ -97,7 +112,7 @@ namespace VIZ.TVP.Module
...
@@ -97,7 +112,7 @@ namespace VIZ.TVP.Module
selectedFolderModel
=
value
;
selectedFolderModel
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SelectedFolderModel
));
this
.
RaisePropertyChanged
(
nameof
(
SelectedFolderModel
));
// 更新文件模型
// 更新文件模型
//
this.mediaResourceFileController.UpdateFileModels(value);
this
.
mediaResourceFileController
.
UpdateFileModels
(
value
);
}
}
}
}
...
@@ -276,6 +291,8 @@ namespace VIZ.TVP.Module
...
@@ -276,6 +291,8 @@ namespace VIZ.TVP.Module
#
region
RefreshFileCommand
--
刷新文件命令
#
region
RefreshFileCommand
--
刷新文件命令
/// <summary>
/// <summary>
/// 刷新文件命令
/// 刷新文件命令
/// </summary>
/// </summary>
...
@@ -286,20 +303,201 @@ namespace VIZ.TVP.Module
...
@@ -286,20 +303,201 @@ namespace VIZ.TVP.Module
/// </summary>
/// </summary>
private
void
RefreshFile
()
private
void
RefreshFile
()
{
{
//MHResourceFolderModel folder = this.SelectedFolderModel;
MHResourceFolderModel
folder
=
this
.
SelectedFolderModel
;
if
(
folder
==
null
)
return
;
this
.
mediaResourceFileController
.
DisposeFileModels
(
folder
);
folder
.
IsRefreshedFiles
=
false
;
this
.
mediaResourceFileController
.
UpdateFileModels
(
this
.
SelectedFolderModel
);
}
#
endregion
#
region
创建文件夹
public
VCommand
CreateFloderCommand
{
get
;
set
;
}
/// <summary>
/// 创建文件夹
/// </summary>
private
void
CreateFloder
()
{
CreateFolderWindow
floderView
=
new
CreateFolderWindow
();
CreateFolderViewModel
vm
=
floderView
.
createFolderView
.
DataContext
as
CreateFolderViewModel
;
floderView
.
ShowDialog
();
if
(
vm
==
null
||
!
vm
.
IsEnter
)
return
;
string
createPath
=
String
.
Format
(
"{0}\\{1}"
,
selectedFolderModel
.
Path
,
vm
.
FolderName
);
SelectedFolderModel
.
Children
.
Add
(
new
MHResourceFolderModel
()
{
Name
=
vm
.
FolderName
,
Path
=
createPath
,
FolderType
=
ResourceFolderType
.
Folder
});
this
.
mediaResourceFileController
.
CreateFolder
(
createPath
);
}
#
endregion
#
region
删除文件夹
public
VCommand
DeleteFloderCommand
{
get
;
set
;
}
private
void
DeleteFloder
()
{
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否此文件夹"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
{
string
path
=
SelectedFolderModel
.
Path
;
SelectedFolderModel
.
Parent
.
Children
.
Remove
(
SelectedFolderModel
);
this
.
mediaResourceFileController
.
DeleteFolder
(
path
);
}
}
#
endregion
#
region
创建文件
public
VCommand
CreateFileCommand
{
get
;
set
;
}
/// <summary>
/// 从配置文件读取
/// </summary>
public
static
AppSettingsSection
config
=
ApplicationDomainEx
.
DataBaseManager
.
ConfigContext
.
configuration
.
AppSettings
;
/// <summary>
/// 从配置文件读取过滤字符串
/// </summary>
private
static
string
filter
=
config
.
Settings
[
"MediaFilter"
].
Value
.
ToString
();
/// <summary>
/// 创建文件方法
/// </summary>
private
async
void
CreateFile
()
{
System
.
Windows
.
Forms
.
OpenFileDialog
ofd
=
new
System
.
Windows
.
Forms
.
OpenFileDialog
();
ofd
.
Filter
=
filter
;
ofd
.
Multiselect
=
false
;
if
(
ofd
.
ShowDialog
()
==
System
.
Windows
.
Forms
.
DialogResult
.
OK
)
{
string
path
=
System
.
IO
.
Path
.
GetFullPath
(
ofd
.
FileName
);
string
fileName
=
ThumbnailHelper
.
GetFileFolderName
(
path
);
var
fileResult
=
await
this
.
mediaResourceFileController
.
CreateFile
(
path
,
fileName
);
if
(
fileResult
!=
null
&&
fileResult
.
errCode
==
"0"
)
{
try
{
MHResourceFileModel
fileModel
=
new
MHResourceFileModel
();
if
(
ThumbnailHelper
.
IsImageByName
(
fileName
))
{
Image
image
=
ThumbnailHelper
.
GetImage
(
path
,
100
,
200
);
Bitmap
btm
=
new
Bitmap
(
image
);
fileModel
.
ThumbnailBitmap
=
btm
;
fileModel
.
FileType
=
ResourceFileType
.
IMAGE
;
fileModel
.
Name
=
fileName
;
this
.
FileModels
.
Add
(
fileModel
);
}
else
if
(
ThumbnailHelper
.
IsVideo
(
fileName
))
{
string
vedioImage
=
string
.
Format
(
"{0}{1}"
,
System
.
Environment
.
CurrentDirectory
,
"\\Resource\\VedioImage\\Vedio.jpeg"
);
Image
image
=
ThumbnailHelper
.
GetImage
(
vedioImage
,
100
,
200
);
Bitmap
btm
=
new
Bitmap
(
image
);
fileModel
.
ThumbnailBitmap
=
btm
;
fileModel
.
FileType
=
ResourceFileType
.
Video
;
fileModel
.
Name
=
fileName
;
this
.
FileModels
.
Add
(
fileModel
);
}
//if (folder == null)
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
.
Message
);
}
}
}
//System.Windows.Forms.FileDialog fbd = new System.Windows.Forms.FileDialog();
//if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
// return;
// return;
}
#
endregion
创建文件
//this.mediaResourceFileController.DisposeFileModels(folder);
#
region
删除文件
//folder.IsRefreshedFiles = false;
public
VCommand
DeleteFileCommand
{
get
;
set
;
}
//this.mediaResourceFileController.UpdateFileModels(this.SelectedFolderModel);
private
void
DeleteFile
()
{
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否删除此文件"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
{
this
.
mediaResourceFileController
.
DeleteFile
(
selectedFileModel
.
Path
);
this
.
FileModels
.
Remove
(
this
.
SelectedFileModel
);
}
}
}
#
endregion
#
endregion
#
region
移动文件
public
VCommand
MoveFileCommand
{
get
;
set
;
}
public
string
moveFilePath
=
""
;
public
MHResourceFileModel
moveFileModel
=
null
;
private
void
MoveFile
()
{
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否移动此文件"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
{
moveFilePath
=
selectedFileModel
.
Path
;
moveFileModel
=
selectedFileModel
;
}
}
public
VCommand
MoveFloderCommand
{
get
;
set
;
}
private
void
MoveFileFloder
()
{
if
(
string
.
IsNullOrEmpty
(
moveFilePath
))
{
// DXMessageBox.Show("请先选择移入的文件,在选择移动此文件夹","移入当前文件夹", MessageBoxButton.YesNo);
DXMessageBox
.
Show
(
"请先选择移入的文件,在选择移动此文件夹"
);
// MessageBox.Show("请先选择移入的文件");
}
else
{
this
.
mediaResourceFileController
.
MoveFile
(
moveFilePath
,
selectedFolderModel
.
Path
);
if
(
moveFileModel
!=
null
)
{
this
.
FileModels
.
Add
(
moveFileModel
);
}
}
}
#
endregion
#
region
FolderExpandCommand
--
文件夹展开命令
#
region
FolderExpandCommand
--
文件夹展开命令
/// <summary>
/// <summary>
...
...
VIZ.TVP.Module/Resource/VedioImage/Vedio.jpeg
0 → 100644
View file @
9527fa3e
13.3 KB
VIZ.TVP.Module/Setup/Provider/Setup/AppSetup_InitMedia.cs
0 → 100644
View file @
9527fa3e
using
DevExpress.DirectX.Common.Direct2D
;
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Module
;
using
VIZ.TVP.Domain
;
namespace
VIZ.TVP.Module
{
public
class
AppSetup_InitMedia
:
AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_InitMedia
));
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 初始化媒体资源库"
;
public
override
bool
Setup
(
AppSetupContext
context
)
{
ApplicationDomainEx
.
DataBaseManager
.
ConfigContext
=
new
Storage
.
ConfigContext
();
this
.
LoadConfig
();
return
true
;
}
/// <summary>
/// 加载插件配置
/// </summary>
private
void
LoadConfig
()
{
string
folder
=
System
.
IO
.
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"config"
);
if
(!
System
.
IO
.
Directory
.
Exists
(
folder
))
{
System
.
IO
.
Directory
.
CreateDirectory
(
folder
);
}
string
path
=
System
.
IO
.
Path
.
Combine
(
folder
,
"MediaResouce.config"
);
ApplicationDomainEx
.
DataBaseManager
.
ConfigContext
.
LoadMediaConfig
(
path
);
}
public
override
void
Shutdown
(
AppSetupContext
context
)
{
}
}
}
VIZ.TVP.Module/VIZ.TVP.Module.csproj
View file @
9527fa3e
...
@@ -102,6 +102,14 @@
...
@@ -102,6 +102,14 @@
<SubType>Designer</SubType>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
</Page>
</Page>
<Page Include="Resource\MediaResource\View\CreateFolder.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Resource\MediaResource\View\CreateFolderWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SettingInner\Control\View\ControlSettingView.xaml">
<Page Include="SettingInner\Control\View\ControlSettingView.xaml">
<SubType>Designer</SubType>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
...
@@ -218,7 +226,15 @@
...
@@ -218,7 +226,15 @@
<Compile Include="Resource\MediaResource\Controller\MediaResourceFile\MediaResourceFileController.cs" />
<Compile Include="Resource\MediaResource\Controller\MediaResourceFile\MediaResourceFileController.cs" />
<Compile Include="Resource\MediaResource\Controller\MediaResourceFile\MediaResourceFileService.cs" />
<Compile Include="Resource\MediaResource\Controller\MediaResourceFile\MediaResourceFileService.cs" />
<Compile Include="Resource\MediaResource\Controller\Model\fileListResult.cs" />
<Compile Include="Resource\MediaResource\Controller\Model\fileListResult.cs" />
<Compile Include="Resource\MediaResource\Controller\Model\fileUploadResult.cs" />
<Compile Include="Resource\MediaResource\Controller\Model\ms.cs" />
<Compile Include="Resource\MediaResource\Controller\Model\ms.cs" />
<Compile Include="Resource\MediaResource\ViewModel\CreateFolderViewModel.cs" />
<Compile Include="Resource\MediaResource\View\CreateFolder.xaml.cs">
<DependentUpon>CreateFolder.xaml</DependentUpon>
</Compile>
<Compile Include="Resource\MediaResource\View\CreateFolderWindow.xaml.cs">
<DependentUpon>CreateFolderWindow.xaml</DependentUpon>
</Compile>
<Compile Include="SettingInner\Control\ViewModel\ControlSettingViewModel.cs" />
<Compile Include="SettingInner\Control\ViewModel\ControlSettingViewModel.cs" />
<Compile Include="SettingInner\Control\View\ControlSettingView.xaml.cs">
<Compile Include="SettingInner\Control\View\ControlSettingView.xaml.cs">
<DependentUpon>ControlSettingView.xaml</DependentUpon>
<DependentUpon>ControlSettingView.xaml</DependentUpon>
...
@@ -319,6 +335,7 @@
...
@@ -319,6 +335,7 @@
<Compile Include="Common\View\TextInputView.xaml.cs">
<Compile Include="Common\View\TextInputView.xaml.cs">
<DependentUpon>TextInputView.xaml</DependentUpon>
<DependentUpon>TextInputView.xaml</DependentUpon>
</Compile>
</Compile>
<Compile Include="Setup\Provider\Setup\AppSetup_InitMedia.cs" />
<Compile Include="Take\ViewModel\TakeViewModel.cs" />
<Compile Include="Take\ViewModel\TakeViewModel.cs" />
<Compile Include="Take\View\TakeView.xaml.cs">
<Compile Include="Take\View\TakeView.xaml.cs">
<DependentUpon>TakeView.xaml</DependentUpon>
<DependentUpon>TakeView.xaml</DependentUpon>
...
@@ -422,5 +439,10 @@
...
@@ -422,5 +439,10 @@
<Folder Include="PluginPanel\Controller\" />
<Folder Include="PluginPanel\Controller\" />
<Folder Include="Program\Controller\" />
<Folder Include="Program\Controller\" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<None Include="Resource\VedioImage\Vedio.jpeg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
\ No newline at end of file
VIZ.TVP.Storage/Config/ConfigContext.cs
0 → 100644
View file @
9527fa3e
using
CsvHelper
;
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Configuration
;
using
System.Globalization
;
using
System.IO
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.TVP.Storage
{
public
class
ConfigContext
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
ConfigContext
));
public
Configuration
configuration
{
get
;
set
;
}
/// <summary>
/// 加载插件配置
/// </summary>
/// <param name="path">文件路径</param>
public
void
LoadMediaConfig
(
string
path
)
{
if
(
File
.
Exists
(
path
)
==
false
)
{
{
string
msg
=
string
.
Format
(
"{0}路径下的文件未找到 "
,
path
);
throw
new
FileNotFoundException
(
msg
);
}
}
try
{
ExeConfigurationFileMap
configFile
=
new
ExeConfigurationFileMap
();
configFile
.
ExeConfigFilename
=
path
;
configuration
=
ConfigurationManager
.
OpenMappedExeConfiguration
(
configFile
,
ConfigurationUserLevel
.
None
);
}
catch
(
Exception
ex
)
{
throw
new
Exception
(
ex
.
Message
);
}
}
}
}
VIZ.TVP.Storage/VIZ.TVP.Storage.csproj
View file @
9527fa3e
...
@@ -95,6 +95,7 @@
...
@@ -95,6 +95,7 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="Config\ConfigContext.cs" />
<Compile Include="CSV\CsvContext.cs" />
<Compile Include="CSV\CsvContext.cs" />
<Compile Include="CSV\Plugin\Enum\PluginTypeEnum.cs" />
<Compile Include="CSV\Plugin\Enum\PluginTypeEnum.cs" />
<Compile Include="CSV\Plugin\PluginConfig.cs" />
<Compile Include="CSV\Plugin\PluginConfig.cs" />
...
...
VIZ.TVP/App.xaml.cs
View file @
9527fa3e
...
@@ -28,6 +28,10 @@ namespace VIZ.TVP
...
@@ -28,6 +28,10 @@ namespace VIZ.TVP
// 初始化CSV
// 初始化CSV
AppSetup
.
AppendSetup
(
new
AppSetup_InitCSV
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitCSV
());
//初始化媒体库配置文件
AppSetup
.
AppendSetup
(
new
AppSetup_InitMedia
());
// 执行启动流程
// 执行启动流程
AppSetupContext
context
=
AppSetup
.
Setup
();
AppSetupContext
context
=
AppSetup
.
Setup
();
...
...
VIZ.TVP/VIZ.TVP.csproj
View file @
9527fa3e
...
@@ -122,6 +122,9 @@
...
@@ -122,6 +122,9 @@
<None Include="config\log.config">
<None Include="config\log.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</None>
<None Include="config\MediaResouce.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\plugin_config.csv">
<None Include="config\plugin_config.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</None>
...
...
VIZ.TVP/config/MediaResouce.config
0 → 100644
View file @
9527fa3e
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
appSettings
>
<
add
key
=
"url"
value
=
"http://localhost:9000/api/home/"
/>
<
add
key
=
"MediaFilter"
value
=
"(*.jpg,*.png,*.jpeg,*.bmp,*.gif,*.avi,*.mp4)|*.jgp;*.png;*.jpeg;*.bmp;*.gif;*.avi;*.mp4"
/>
</
appSettings
>
</
configuration
>
\ No newline at end of file
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