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
511807e7
Commit
511807e7
authored
Jan 05, 2023
by
wangonghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
媒体资源库测试修改bug
parent
9527fa3e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
264 additions
and
122 deletions
+264
-122
VIZ.TVP.Module/Resource/LocalResource/Controller/LocalResourceFile/ThumbnailHelper.cs
+11
-0
VIZ.TVP.Module/Resource/MediaResource/Controller/MediaResourceFile/MediaResourceFileController.cs
+44
-17
VIZ.TVP.Module/Resource/MediaResource/Controller/MediaResourceFile/MediaResourceFileService.cs
+46
-51
VIZ.TVP.Module/Resource/MediaResource/Controller/Model/fileListResult.cs
+13
-0
VIZ.TVP.Module/Resource/MediaResource/Controller/Model/fileUploadResult.cs
+3
-0
VIZ.TVP.Module/Resource/MediaResource/Controller/Model/ms.cs
+12
-0
VIZ.TVP.Module/Resource/MediaResource/ViewModel/CreateFolderViewModel.cs
+6
-1
VIZ.TVP.Module/Resource/MediaResource/ViewModel/MediaResourceViewModel.cs
+129
-53
No files found.
VIZ.TVP.Module/Resource/LocalResource/Controller/LocalResourceFile/ThumbnailHelper.cs
View file @
511807e7
...
@@ -80,6 +80,11 @@ namespace VIZ.TVP.Module
...
@@ -80,6 +80,11 @@ namespace VIZ.TVP.Module
}
}
}
}
/// <summary>
/// 根据名称判断是否为图片
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public
static
Boolean
IsImageByName
(
string
name
)
public
static
Boolean
IsImageByName
(
string
name
)
{
{
try
try
...
@@ -102,6 +107,12 @@ namespace VIZ.TVP.Module
...
@@ -102,6 +107,12 @@ namespace VIZ.TVP.Module
}
}
/// <summary>
/// 不区分大小写进行判断
/// </summary>
/// <param name="source"></param>
/// <param name="list"></param>
/// <returns></returns>
private
static
bool
IsInIgnoreCase
(
string
source
,
params
string
[]
list
)
private
static
bool
IsInIgnoreCase
(
string
source
,
params
string
[]
list
)
{
{
if
(
null
==
source
)
return
false
;
if
(
null
==
source
)
return
false
;
...
...
VIZ.TVP.Module/Resource/MediaResource/Controller/MediaResourceFile/MediaResourceFileController.cs
View file @
511807e7
...
@@ -48,6 +48,10 @@ namespace VIZ.TVP.Module
...
@@ -48,6 +48,10 @@ namespace VIZ.TVP.Module
/// <summary>
/// <summary>
/// 根目录
/// </summary>
public
string
RootPath
{
get
;
set
;
}
/// <summary>
/// 更新文件模型
/// 更新文件模型
/// </summary>
/// </summary>
/// <param name="folder">文件夹</param>
/// <param name="folder">文件夹</param>
...
@@ -84,7 +88,6 @@ namespace VIZ.TVP.Module
...
@@ -84,7 +88,6 @@ namespace VIZ.TVP.Module
MHResourceFileModel
GHFile
=
new
MHResourceFileModel
();
MHResourceFileModel
GHFile
=
new
MHResourceFileModel
();
if
(
ThumbnailHelper
.
IsImageByName
(
file
.
fileName
))
if
(
ThumbnailHelper
.
IsImageByName
(
file
.
fileName
))
{
{
//GetFile
GHFile
.
Name
=
file
.
fileName
;
GHFile
.
Name
=
file
.
fileName
;
GHFile
.
Path
=
file
.
smallIconUrl
;
GHFile
.
Path
=
file
.
smallIconUrl
;
string
url
=
string
.
Format
(
"{0}GetFile?filePath={1}"
,
httpUrl
,
GHFile
.
Path
);
string
url
=
string
.
Format
(
"{0}GetFile?filePath={1}"
,
httpUrl
,
GHFile
.
Path
);
...
@@ -125,22 +128,27 @@ namespace VIZ.TVP.Module
...
@@ -125,22 +128,27 @@ namespace VIZ.TVP.Module
});
});
}
}
//string oldFile, string newFile
/// <summary>
public
async
void
MoveFile
(
string
oldPath
,
string
newPath
)
/// 移动文件
/// </summary>
/// <param name="oldPath"></param>
/// <param name="newPath"></param>
public
async
Task
<
fileListResult
>
MoveFile
(
string
oldPath
,
string
newPath
)
{
{
string
header
=
string
.
Format
(
"{0}MoveFile?oldFile={1}&newFile={2}"
,
httpUrl
,
oldPath
,
newPath
);
string
header
=
string
.
Format
(
"{0}MoveFile?oldFile={1}&newFile={2}"
,
httpUrl
,
oldPath
,
newPath
);
var
errorMessage
=
await
MediaResourceFileService
.
PostAsyncJson
(
header
,
""
);
var
result
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
header
,
""
);
return
result
;
}
}
/// <summary>
/// <summary>
/// 添加文件夹
/// 添加文件夹
/// </summary>
/// </summary>
/// <param name="path"></param>
/// <param name="path"></param>
public
async
void
CreateFolder
(
string
path
)
public
async
Task
<
fileListResult
>
CreateFolder
(
string
path
)
{
{
string
header
=
string
.
Format
(
"{0}CreateFiles?
newDir
={1}"
,
httpUrl
,
path
);
string
header
=
string
.
Format
(
"{0}CreateFiles?
filePath
={1}"
,
httpUrl
,
path
);
var
strError
=
await
MediaResourceFileService
.
PostAsyncJson
(
header
,
""
);
var
result
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>
(
header
,
""
);
return
result
;
}
}
...
@@ -148,10 +156,11 @@ namespace VIZ.TVP.Module
...
@@ -148,10 +156,11 @@ namespace VIZ.TVP.Module
/// 删除文件夹
/// 删除文件夹
/// </summary>
/// </summary>
/// <param name="path"></param>
/// <param name="path"></param>
public
async
void
DeleteFolder
(
string
path
)
public
async
Task
<
fileListResult
>
DeleteFolder
(
string
path
)
{
{
string
header
=
string
.
Format
(
"{0}DeleteFiles?delDir={1}"
,
httpUrl
,
path
);
string
header
=
string
.
Format
(
"{0}DeleteFiles?filePath={1}"
,
httpUrl
,
path
);
var
strError
=
await
MediaResourceFileService
.
PostAsyncJson
(
header
,
""
);
var
result
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
header
,
""
);
return
result
;
}
}
/// <summary>
/// <summary>
...
@@ -166,20 +175,37 @@ namespace VIZ.TVP.Module
...
@@ -166,20 +175,37 @@ namespace VIZ.TVP.Module
fileUploadResult
upLoadResult
=
await
MediaResourceFileService
.
PostImage
<
fileUploadResult
>(
requestUri
,
filePath
,
fileName
);
fileUploadResult
upLoadResult
=
await
MediaResourceFileService
.
PostImage
<
fileUploadResult
>(
requestUri
,
filePath
,
fileName
);
if
(
upLoadResult
==
null
)
return
null
;
return
upLoadResult
;
return
upLoadResult
;
}
}
/// <summary>
public
async
void
DeleteFile
(
string
path
)
/// 删除文件
/// </summary>
/// <param name="path"></param>
public
async
Task
<
fileListResult
>
DeleteFile
(
string
path
)
{
{
string
header
=
string
.
Format
(
"{0}DeleteFile?delFile={1}"
,
httpUrl
,
path
);
try
var
strError
=
await
MediaResourceFileService
.
PostAsyncJson
(
header
,
""
);
{
string
header
=
string
.
Format
(
"{0}DeleteFile?filePath={1}"
,
httpUrl
,
path
);
var
result
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
header
,
""
);
return
result
;
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
.
Message
);
return
null
;
}
}
}
/// <summary>
/// <summary>
///获取文件
///获取文件
夹
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
...
@@ -188,9 +214,10 @@ namespace VIZ.TVP.Module
...
@@ -188,9 +214,10 @@ namespace VIZ.TVP.Module
// var config =
// var config =
var
folderResult
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
string
.
Format
(
"{0}GetListFiles"
,
httpUrl
),
""
);
var
folderResult
=
await
MediaResourceFileService
.
PostObjectAsync
<
fileListResult
,
string
>(
string
.
Format
(
"{0}GetListFiles"
,
httpUrl
),
""
);
if
(
folderResult
==
null
)
if
(
folderResult
==
null
)
return
null
;
return
null
;
RootPath
=
folderResult
.
rootPath
;
return
GetFolder
(
folderResult
.
masterData
);
return
GetFolder
(
folderResult
.
masterData
);
}
}
...
...
VIZ.TVP.Module/Resource/MediaResource/Controller/MediaResourceFile/MediaResourceFileService.cs
View file @
511807e7
...
@@ -66,16 +66,7 @@ namespace VIZ.TVP.Module
...
@@ -66,16 +66,7 @@ namespace VIZ.TVP.Module
HttpResponseMessage
response
=
await
client
.
PostAsync
(
url
,
content
);
HttpResponseMessage
response
=
await
client
.
PostAsync
(
url
,
content
);
response
.
EnsureSuccessStatusCode
();
response
.
EnsureSuccessStatusCode
();
string
responseBody
=
""
;
string
responseBody
=
""
;
//if (Gzip)
//{
// GZipInputStream inputStream = new GZipInputStream(await response.Content.ReadAsStreamAsync());
// responseBody = new StreamReader(inputStream).ReadToEnd();
//}
//else
//{
responseBody
=
await
response
.
Content
.
ReadAsStringAsync
();
responseBody
=
await
response
.
Content
.
ReadAsStringAsync
();
//}
return
responseBody
;
return
responseBody
;
}
}
...
@@ -99,16 +90,7 @@ namespace VIZ.TVP.Module
...
@@ -99,16 +90,7 @@ namespace VIZ.TVP.Module
HttpResponseMessage
response
=
await
client
.
GetAsync
(
url
);
HttpResponseMessage
response
=
await
client
.
GetAsync
(
url
);
response
.
EnsureSuccessStatusCode
();
//用来抛异常的
response
.
EnsureSuccessStatusCode
();
//用来抛异常的
string
responseBody
=
""
;
string
responseBody
=
""
;
//if (Gzip)
//{
// GZipInputStream inputStream = new GZipInputStream(await response.Content.ReadAsStreamAsync());
// responseBody = new StreamReader(inputStream).ReadToEnd();
//}
//else
//{
responseBody
=
await
response
.
Content
.
ReadAsStringAsync
();
responseBody
=
await
response
.
Content
.
ReadAsStringAsync
();
//}
return
responseBody
;
return
responseBody
;
}
}
...
@@ -122,9 +104,19 @@ namespace VIZ.TVP.Module
...
@@ -122,9 +104,19 @@ namespace VIZ.TVP.Module
/// <returns>请求返回的目标对象</returns>
/// <returns>请求返回的目标对象</returns>
public
static
async
Task
<
T
>
PostObjectAsync
<
T
,
T2
>(
string
url
,
T2
obj
)
public
static
async
Task
<
T
>
PostObjectAsync
<
T
,
T2
>(
string
url
,
T2
obj
)
{
{
String
json
=
JsonConvert
.
SerializeObject
(
obj
);
try
string
responseBody
=
await
PostAsyncJson
(
url
,
json
);
//请求当前账户的信息
{
return
JsonConvert
.
DeserializeObject
<
T
>(
responseBody
);
//把收到的字符串序列化
String
json
=
JsonConvert
.
SerializeObject
(
obj
);
string
responseBody
=
await
PostAsyncJson
(
url
,
json
);
//请求当前账户的信息
return
JsonConvert
.
DeserializeObject
<
T
>(
responseBody
);
//把收到的字符串序列化
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
.
Message
);
return
default
(
T
);
}
}
}
/// <summary>
/// <summary>
...
@@ -148,19 +140,26 @@ namespace VIZ.TVP.Module
...
@@ -148,19 +140,26 @@ namespace VIZ.TVP.Module
/// <returns></returns>
/// <returns></returns>
public
static
async
Task
<
MemoryStream
>
GetImage
(
string
url
)
public
static
async
Task
<
MemoryStream
>
GetImage
(
string
url
)
{
{
HttpClient
client
=
new
HttpClient
(
new
HttpClientHandler
()
{
UseCookies
=
false
});
try
HttpResponseMessage
response
=
await
client
.
GetAsync
(
url
);
response
.
EnsureSuccessStatusCode
();
//用来抛异常的
using
(
Stream
stream
=
response
.
Content
.
ReadAsStreamAsync
().
Result
)
{
{
MemoryStream
ms
=
new
MemoryStream
();
HttpClient
client
=
new
HttpClient
(
new
HttpClientHandler
()
{
UseCookies
=
false
});
stream
.
CopyTo
(
ms
);
HttpResponseMessage
response
=
await
client
.
GetAsync
(
url
);
response
.
EnsureSuccessStatusCode
();
//用来抛异常的
return
ms
;
using
(
Stream
stream
=
response
.
Content
.
ReadAsStreamAsync
().
Result
)
{
MemoryStream
ms
=
new
MemoryStream
();
stream
.
CopyTo
(
ms
);
return
ms
;
}
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
.
Message
);
return
null
;
}
}
}
}
/// <summary>
/// <summary>
...
@@ -173,29 +172,25 @@ namespace VIZ.TVP.Module
...
@@ -173,29 +172,25 @@ namespace VIZ.TVP.Module
/// <returns></returns>
/// <returns></returns>
public
static
async
Task
<
T
>
PostImage
<
T
>(
string
requestUri
,
string
path
,
string
fileName
)
public
static
async
Task
<
T
>
PostImage
<
T
>(
string
requestUri
,
string
path
,
string
fileName
)
{
{
try
{
HttpClient
client
=
new
HttpClient
();
var
content
=
new
MultipartFormDataContent
();
content
.
Headers
.
Add
(
"ContentType"
,
$"multipart/form-data"
);
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
);
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
.
Message
);
return
default
(
T
);
}
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/fileListResult.cs
View file @
511807e7
...
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
...
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace
VIZ.TVP.Module
namespace
VIZ.TVP.Module
{
{
/// <summary>
/// 文件信息从提供媒体库服务的实体类拷贝出来的
/// </summary>
public
class
fileListResult
public
class
fileListResult
{
{
/// <summary>
/// <summary>
...
@@ -35,6 +38,16 @@ namespace VIZ.TVP.Module
...
@@ -35,6 +38,16 @@ namespace VIZ.TVP.Module
}
}
/// <summary>
/// <summary>
/// 根目录
/// </summary>
public
string
rootPath
{
get
;
set
;
}
/// <summary>
/// 设置文件信息
/// 设置文件信息
/// </summary>
/// </summary>
public
List
<
ms
>
masterData
=
new
List
<
ms
>();
public
List
<
ms
>
masterData
=
new
List
<
ms
>();
...
...
VIZ.TVP.Module/Resource/MediaResource/Controller/Model/fileUploadResult.cs
View file @
511807e7
...
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
...
@@ -6,6 +6,9 @@ using System.Threading.Tasks;
namespace
VIZ.TVP.Module.Resource.MediaResource.Controller.Model
namespace
VIZ.TVP.Module.Resource.MediaResource.Controller.Model
{
{
/// <summary>
/// 文件上传的实体对象
/// </summary>
public
class
fileUploadResult
public
class
fileUploadResult
{
{
/// <summary>
/// <summary>
...
...
VIZ.TVP.Module/Resource/MediaResource/Controller/Model/ms.cs
View file @
511807e7
...
@@ -6,18 +6,30 @@ using System.Threading.Tasks;
...
@@ -6,18 +6,30 @@ using System.Threading.Tasks;
namespace
VIZ.TVP.Module
namespace
VIZ.TVP.Module
{
{
/// <summary>
/// 文件信息从拷贝出来的
/// </summary>
public
class
ms
public
class
ms
{
{
/// <summary>
/// 文件名称
/// </summary>
public
string
fileName
public
string
fileName
{
{
get
;
get
;
set
;
set
;
}
}
/// <summary>
/// 文件地址
/// </summary>
public
string
smallIconUrl
public
string
smallIconUrl
{
{
get
;
get
;
set
;
set
;
}
}
/// <summary>
/// 文件类型
/// </summary>
public
string
fileType
public
string
fileType
{
{
get
;
get
;
...
...
VIZ.TVP.Module/Resource/MediaResource/ViewModel/CreateFolderViewModel.cs
View file @
511807e7
...
@@ -13,7 +13,9 @@ namespace VIZ.TVP.Module
...
@@ -13,7 +13,9 @@ namespace VIZ.TVP.Module
public
class
CreateFolderViewModel
:
PluginViewModelBase
public
class
CreateFolderViewModel
:
PluginViewModelBase
{
{
/// <summary>
/// 初始化
/// </summary>
public
CreateFolderViewModel
()
public
CreateFolderViewModel
()
{
{
EnterCommand
=
new
VCommand
(
Enter
);
EnterCommand
=
new
VCommand
(
Enter
);
...
@@ -22,6 +24,9 @@ namespace VIZ.TVP.Module
...
@@ -22,6 +24,9 @@ namespace VIZ.TVP.Module
private
string
folderName
;
private
string
folderName
;
/// <summary>
/// 文件夹名称
/// </summary>
public
string
FolderName
public
string
FolderName
{
{
get
{
return
folderName
;
}
get
{
return
folderName
;
}
...
...
VIZ.TVP.Module/Resource/MediaResource/ViewModel/MediaResourceViewModel.cs
View file @
511807e7
...
@@ -249,36 +249,18 @@ namespace VIZ.TVP.Module
...
@@ -249,36 +249,18 @@ namespace VIZ.TVP.Module
{
{
try
try
{
{
//LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LocalInfo;
//string url = $"http://{info.GH_IP}:{info.GH_Port}/folders/";
//List<GHResourceFolderModel> list = this.ghResourceService.GetGHResourceFolders(url, null);
//WPFHelper.BeginInvoke(() =>
//{
// this.FolderModels = list.FirstOrDefault()?.Children.Select(p => (GHResourceFolderModel)p).ToObservableCollection();
// this.IsFolderLoading = false;
//});
//http://192.168.3.76:9000/api/home/GetListFiles
List
<
MHResourceFolderModel
>
list
=
await
this
.
mediaResourceFileController
.
GetMeiaResourceFolder
();
List
<
MHResourceFolderModel
>
list
=
await
this
.
mediaResourceFileController
.
GetMeiaResourceFolder
();
if
(
list
==
null
)
return
;
if
(
list
==
null
)
{
return
;
}
this
.
FolderModels
=
list
.
ToObservableCollection
();
this
.
FolderModels
=
list
.
ToObservableCollection
();
//WPFHelper.BeginInvoke(() =>
//{
// this.FolderModels = list.FirstOrDefault()?.Children.Select(p => (GHResourceFolderModel)p).ToObservableCollection();
this
.
IsFolderLoading
=
false
;
this
.
IsFolderLoading
=
false
;
// });
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -309,9 +291,7 @@ namespace VIZ.TVP.Module
...
@@ -309,9 +291,7 @@ namespace VIZ.TVP.Module
return
;
return
;
this
.
mediaResourceFileController
.
DisposeFileModels
(
folder
);
this
.
mediaResourceFileController
.
DisposeFileModels
(
folder
);
folder
.
IsRefreshedFiles
=
false
;
folder
.
IsRefreshedFiles
=
false
;
this
.
mediaResourceFileController
.
UpdateFileModels
(
this
.
SelectedFolderModel
);
this
.
mediaResourceFileController
.
UpdateFileModels
(
this
.
SelectedFolderModel
);
}
}
...
@@ -324,7 +304,7 @@ namespace VIZ.TVP.Module
...
@@ -324,7 +304,7 @@ namespace VIZ.TVP.Module
/// <summary>
/// <summary>
/// 创建文件夹
/// 创建文件夹
/// </summary>
/// </summary>
private
void
CreateFloder
()
private
async
void
CreateFloder
()
{
{
CreateFolderWindow
floderView
=
new
CreateFolderWindow
();
CreateFolderWindow
floderView
=
new
CreateFolderWindow
();
...
@@ -335,15 +315,62 @@ namespace VIZ.TVP.Module
...
@@ -335,15 +315,62 @@ namespace VIZ.TVP.Module
if
(
vm
==
null
||
!
vm
.
IsEnter
)
if
(
vm
==
null
||
!
vm
.
IsEnter
)
return
;
return
;
string
createPath
=
String
.
Format
(
"{0}\\{1}"
,
selectedFolderModel
.
Path
,
vm
.
FolderName
);
if
(
this
.
FolderModels
==
null
)
SelectedFolderModel
.
Children
.
Add
(
new
MHResourceFolderModel
()
return
;
string
createPath
=
""
;
//创建根目录文件夹
if
(
this
.
FolderModels
.
Count
==
0
)
{
{
Name
=
vm
.
FolderName
,
createPath
=
string
.
Format
(
"{0}\\{1}"
,
this
.
mediaResourceFileController
.
RootPath
,
vm
.
FolderName
);
Path
=
createPath
,
var
result
=
await
this
.
mediaResourceFileController
.
CreateFolder
(
createPath
);
FolderType
=
ResourceFolderType
.
Folder
if
(
result
!=
null
)
});
{
if
(
result
.
status
==
"0"
)
{
this
.
folderModels
.
Add
(
new
MHResourceFolderModel
()
{
Name
=
vm
.
FolderName
,
Path
=
createPath
,
FolderType
=
ResourceFolderType
.
Folder
});
}
else
{
log
.
Error
(
result
.
message
);
}
}
}
else
{
createPath
=
string
.
Format
(
"{0}\\{1}"
,
selectedFolderModel
.
Path
,
vm
.
FolderName
);
var
result
=
await
this
.
mediaResourceFileController
.
CreateFolder
(
createPath
);
if
(
result
!=
null
)
{
if
(
result
.
status
==
"0"
)
{
SelectedFolderModel
.
Children
.
Add
(
new
MHResourceFolderModel
()
{
Name
=
vm
.
FolderName
,
Path
=
createPath
,
FolderType
=
ResourceFolderType
.
Folder
,
Parent
=
selectedFolderModel
});
}
else
{
log
.
Error
(
result
.
message
);
}
}
}
this
.
mediaResourceFileController
.
CreateFolder
(
createPath
);
}
}
...
@@ -353,15 +380,36 @@ namespace VIZ.TVP.Module
...
@@ -353,15 +380,36 @@ namespace VIZ.TVP.Module
public
VCommand
DeleteFloderCommand
{
get
;
set
;
}
public
VCommand
DeleteFloderCommand
{
get
;
set
;
}
private
void
DeleteFloder
()
private
async
void
DeleteFloder
()
{
{
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否此文件夹"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
if
(
selectedFolderModel
!=
null
)
{
{
string
path
=
SelectedFolderModel
.
Path
;
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否此文件夹"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
SelectedFolderModel
.
Parent
.
Children
.
Remove
(
SelectedFolderModel
);
{
this
.
mediaResourceFileController
.
DeleteFolder
(
path
);
string
path
=
SelectedFolderModel
.
Path
;
}
var
result
=
await
this
.
mediaResourceFileController
.
DeleteFolder
(
path
);
if
(
result
!=
null
)
{
if
(
SelectedFolderModel
.
Parent
!=
null
)
{
if
(
result
.
status
==
"0"
)
{
SelectedFolderModel
.
Parent
.
Children
.
Remove
(
SelectedFolderModel
);
}
else
{
log
.
Error
(
result
.
message
);
}
}
else
{
this
.
FolderModels
.
Remove
(
SelectedFolderModel
);
}
}
}
}
}
}
#
endregion
#
endregion
...
@@ -430,9 +478,6 @@ namespace VIZ.TVP.Module
...
@@ -430,9 +478,6 @@ namespace VIZ.TVP.Module
}
}
}
}
}
}
//System.Windows.Forms.FileDialog fbd = new System.Windows.Forms.FileDialog();
//if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
// return;
}
}
#
endregion
创建文件
#
endregion
创建文件
...
@@ -440,14 +485,25 @@ namespace VIZ.TVP.Module
...
@@ -440,14 +485,25 @@ namespace VIZ.TVP.Module
public
VCommand
DeleteFileCommand
{
get
;
set
;
}
public
VCommand
DeleteFileCommand
{
get
;
set
;
}
private
void
DeleteFile
()
private
async
void
DeleteFile
()
{
{
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否删除此文件"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否删除此文件"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
{
{
this
.
mediaResourceFileController
.
DeleteFile
(
selectedFileModel
.
Path
);
var
result
=
await
this
.
mediaResourceFileController
.
DeleteFile
(
selectedFileModel
.
Path
);
if
(
result
!=
null
)
{
if
(
result
.
status
==
"0"
)
{
this
.
FileModels
.
Remove
(
this
.
SelectedFileModel
);
}
else
{
log
.
Error
(
result
.
message
);
}
}
this
.
FileModels
.
Remove
(
this
.
SelectedFileModel
);
}
}
}
}
...
@@ -464,19 +520,27 @@ namespace VIZ.TVP.Module
...
@@ -464,19 +520,27 @@ namespace VIZ.TVP.Module
private
void
MoveFile
()
private
void
MoveFile
()
{
{
if
(
selectedFileModel
!=
null
)
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否移动此文件"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
{
{
moveFilePath
=
selectedFileModel
.
Path
;
if
((
DialogResult
)
DXMessageBox
.
Show
(
"是否移动此文件"
,
""
,
MessageBoxButton
.
YesNo
)
==
DialogResult
.
Yes
)
moveFileModel
=
selectedFileModel
;
{
moveFilePath
=
selectedFileModel
.
Path
;
moveFileModel
=
selectedFileModel
;
}
}
}
}
}
public
VCommand
MoveFloderCommand
{
get
;
set
;
}
public
VCommand
MoveFloderCommand
{
get
;
set
;
}
private
void
MoveFileFloder
()
/// <summary>
/// 移动文件到文件夹
/// </summary>
private
async
void
MoveFileFloder
()
{
{
if
(
string
.
IsNullOrEmpty
(
moveFilePath
))
if
(
string
.
IsNullOrEmpty
(
moveFilePath
))
{
{
...
@@ -487,12 +551,24 @@ namespace VIZ.TVP.Module
...
@@ -487,12 +551,24 @@ namespace VIZ.TVP.Module
}
}
else
else
{
{
this
.
mediaResourceFileController
.
MoveFile
(
moveFilePath
,
selectedFolderModel
.
Path
);
var
result
=
await
this
.
mediaResourceFileController
.
MoveFile
(
moveFilePath
,
selectedFolderModel
.
Path
);
if
(
moveFileModel
!=
null
)
if
(
result
!=
null
)
{
{
this
.
FileModels
.
Add
(
moveFileModel
);
if
(
result
.
status
==
"0"
)
{
if
(
moveFileModel
!=
null
)
{
this
.
FileModels
.
Add
(
moveFileModel
);
}
}
else
{
log
.
Error
(
result
.
message
);
}
}
}
}
}
}
}
#
endregion
#
endregion
...
...
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