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
9fed74ce
Commit
9fed74ce
authored
Apr 18, 2023
by
wangonghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目工程添加保存和添加提示信息
parent
bebfaab6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
114 additions
and
2 deletions
+114
-2
VIZ.Package.Domain/RecordLogConstants.cs
+6
-0
VIZ.Package.Module/Main/View/MainTopView.xaml
+4
-0
VIZ.Package.Module/Main/ViewModel/MainTopViewModel.cs
+81
-2
VIZ.Package.Module/ProjectManager/ViewModel/SaveProjectWindowModel.cs
+17
-0
VIZ.Package.Module/Resource/GHResource/ViewModel/GHSceneViewModel.cs
+6
-0
No files found.
VIZ.Package.Domain/RecordLogConstants.cs
View file @
9fed74ce
...
...
@@ -126,6 +126,12 @@ namespace VIZ.Package.Domain
/// </summary>
public
const
string
OPERATE_PROJECT_SAVE
=
"保存项目"
;
/// <summary>
/// 另存项目
/// </summary>
public
const
string
OPERATE_PROJECT_SAVEAS
=
"另存项目"
;
/// <summary>
/// 关闭项目
/// </summary>
...
...
VIZ.Package.Module/Main/View/MainTopView.xaml
View file @
9fed74ce
...
...
@@ -74,8 +74,12 @@
Command="{Binding Path=OpenProjectCommand}" />
<dxb:BarButtonItem Content="保存" Glyph="/VIZ.Package.Module.Resource;component/Icons/top_icon_save_20x20.png"
Command="{Binding Path=SaveProjectCommand}" />
<dxb:BarButtonItem Content="另保存" Glyph="/VIZ.Package.Module.Resource;component/Icons/icon_save_as_30x30.png"
Command="{Binding Path=SaveAsProjectCommand}" />
<dxb:BarButtonItem Content="关闭" Glyph="/VIZ.Package.Module.Resource;component/Icons/top_icon_close_20x20.png"
Command="{Binding Path=CloseProjectCommand}" />
</dxb:BarSubItem>
<dxb:BarSubItem Content="设置" Command="{Binding Path=SettingCommand}">
</dxb:BarSubItem>
...
...
VIZ.Package.Module/Main/ViewModel/MainTopViewModel.cs
View file @
9fed74ce
...
...
@@ -51,6 +51,7 @@ namespace VIZ.Package.Module
this
.
CreateProjectCommand
=
new
VCommand
(
this
.
CreateProject
);
this
.
OpenProjectCommand
=
new
VCommand
(
this
.
OpenProject
);
this
.
SaveProjectCommand
=
new
VCommand
(
this
.
SaveProject
,
this
.
CanSaveProject
);
this
.
SaveAsProjectCommand
=
new
VCommand
(
this
.
SaveAsProject
,
this
.
CanSaveProject
);
this
.
CloseProjectCommand
=
new
VCommand
(
this
.
CloseProject
,
this
.
CanCloseProject
);
this
.
SettingCommand
=
new
VCommand
(
this
.
Setting
);
...
...
@@ -189,7 +190,7 @@ namespace VIZ.Package.Module
Header
=
"管理布局"
,
Icon
=
"/VIZ.Package.Module.Resource;component/Icons/top_icon_layout_20x20.png"
,
Type
=
MenuItemType
.
Button
,
// FilePath = path,
// FilePath = path,
Command
=
this
.
ManageLayoutCommand
});
...
...
@@ -392,6 +393,84 @@ namespace VIZ.Package.Module
#
endregion
#
region
SaveAsProjectCommand
---
另存项目命令
/// <summary>
/// 另存为项目命令
/// </summary>
public
VCommand
SaveAsProjectCommand
{
get
;
set
;
}
/// <summary>
/// 另存为文件
/// </summary>
private
void
SaveAsProject
()
{
// 创建项目文件
SaveProjectWindow
window
=
new
SaveProjectWindow
();
window
.
ShowDialog
();
if
(
window
.
DialogResult
!=
true
)
return
;
SaveProjectWindowModel
vm
=
window
.
DataContext
as
SaveProjectWindowModel
;
if
(
vm
==
null
)
return
;
//取的另取文件路径
string
path
=
System
.
IO
.
Path
.
Combine
(
vm
.
SelectedFolderModel
.
Path
,
vm
.
ProjectName
);
string
logPath
=
System
.
IO
.
Path
.
Combine
(
vm
.
SelectedFolderModel
.
Path
,
vm
.
ProjectLogName
);
if
(
path
.
Equals
(
ApplicationDomainEx
.
VizConfig
.
ProjectPath
))
{
DXMessageBox
.
Show
(
"文件名与当前打开项目名称一致,保存失败"
);
return
;
}
ApplicationDomainEx
.
ProjectDbContext
.
Dispose
();
System
.
IO
.
File
.
Copy
(
ApplicationDomainEx
.
VizConfig
.
ProjectPath
,
path
,
true
);
DirectoryInfo
pathInfo
=
new
DirectoryInfo
(
ApplicationDomainEx
.
VizConfig
.
ProjectPath
);
string
sourceLogPath
=
System
.
IO
.
Path
.
Combine
(
pathInfo
.
Parent
.
FullName
,
this
.
ProjectName
+
ApplicationConstants
.
PROJECT_FILE_LOG_NAME_SUFFIX
);
if
(
System
.
IO
.
File
.
Exists
(
sourceLogPath
))
{
System
.
IO
.
File
.
Copy
(
sourceLogPath
,
logPath
,
true
);
}
//把新的东西保存新的库里
ApplicationDomainEx
.
ProjectDbContext
=
new
ProjectDbContext
(
path
);
ProjectSaveMessage
msg
=
new
ProjectSaveMessage
();
ApplicationDomainEx
.
MessageManager
.
Send
(
msg
);
// 保存当前项目的完整路径
ApplicationDomainEx
.
VizConfig
.
ProjectPath
=
path
;
ApplicationDomainEx
.
LocalDbContext
.
VizConfig
.
Update
(
ApplicationDomainEx
.
VizConfig
);
this
.
ProjectName
=
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
path
);
// 记录操作日志
this
.
recordLogService
.
AppendLog
(
ApplicationConstants
.
APPLICATION_GROUP_NAME
,
RecordLogOperate
.
Operate
,
RecordLogTrigger
.
Human
,
RecordLogConstants
.
OPERATE_PROJECT_SAVEAS
,
path
);
// 发送弹出提示
AlertMessage
alertMessage
=
new
AlertMessage
();
alertMessage
.
Message
=
"保存成功"
;
ApplicationDomainEx
.
MessageManager
.
Send
(
alertMessage
);
ProjectOpenMessage
openMsg
=
new
ProjectOpenMessage
();
ApplicationDomainEx
.
MessageManager
.
Send
(
openMsg
);
//在还原成之前的库
// ApplicationDomainEx.ProjectDbContext = new ProjectDbContext(ApplicationDomainEx.VizConfig.ProjectPath);
}
#
endregion
#
region
CloseProjectCommand
--
关闭项目命令
/// <summary>
...
...
@@ -567,7 +646,7 @@ namespace VIZ.Package.Module
ManagerLayoutViewModel
vm
=
managerLayout
.
DataContext
as
ManagerLayoutViewModel
;
vm
.
ItemsSource
=
ItemsSource
.
Where
(
a
=>
!
string
.
IsNullOrEmpty
(
a
.
FilePath
)
&&
Convert
.
ToString
(
a
.
Header
)
!=
"保存布局"
).
ToObservableCollection
();
vm
.
ItemsSource
=
ItemsSource
.
Where
(
a
=>
!
string
.
IsNullOrEmpty
(
a
.
FilePath
)
&&
Convert
.
ToString
(
a
.
Header
)
!=
"保存布局"
).
ToObservableCollection
();
managerLayout
.
ShowDialog
();
}
...
...
VIZ.Package.Module/ProjectManager/ViewModel/SaveProjectWindowModel.cs
View file @
9fed74ce
...
...
@@ -63,6 +63,16 @@ namespace VIZ.Package.Module
set
{
projectName
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
ProjectName
));
}
}
private
string
projectLogName
;
public
string
ProjectLogName
{
get
{
return
projectLogName
;
}
set
{
projectLogName
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
ProjectLogName
));
}
}
#
endregion
// ==========================================================================
...
...
@@ -95,12 +105,19 @@ namespace VIZ.Package.Module
string
file
=
this
.
ProjectName
;
if
(!
this
.
ProjectName
.
ToLower
().
EndsWith
(
ApplicationConstants
.
PROJECT_FILE_EXTENSION
))
{
//log日志文件名称
this
.
ProjectLogName
=
$"
{
file
}{
ApplicationConstants
.
PROJECT_FILE_LOG_NAME_SUFFIX
}
"
;
file
=
$"
{
file
}{
ApplicationConstants
.
PROJECT_FILE_EXTENSION
}
"
;
this
.
ProjectName
=
file
;
}
string
path
=
System
.
IO
.
Path
.
Combine
(
this
.
SelectedFolderModel
.
Path
,
file
);
if
(
System
.
IO
.
File
.
Exists
(
path
))
{
var
result
=
DXMessageBox
.
Show
(
$"项目:\"
{
file
}
\" 已经存在,是否覆盖"
,
"提示"
,
MessageBoxButton
.
YesNo
);
...
...
VIZ.Package.Module/Resource/GHResource/ViewModel/GHSceneViewModel.cs
View file @
9fed74ce
...
...
@@ -53,6 +53,12 @@ namespace VIZ.Package.Module
return
;
}
if
(
ApplicationDomainEx
.
ProjectDbContext
==
null
)
{
DXMessageBox
.
Show
(
"请先创建项目文件或者打开项目文件"
);
return
;
}
IPageTemplateService
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageTemplateService
>(
ViewServiceKeys
.
PAGE_TEMPLATE_SERVICE
);
if
(
service
==
null
)
return
;
...
...
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