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
6aed39c7
Commit
6aed39c7
authored
Apr 23, 2023
by
wangonghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
布局功能添加默认布局
parent
e110e38f
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
166 additions
and
22 deletions
+166
-22
VIZ.Package.Domain/ApplicationDomainEx.cs
+5
-0
VIZ.Package.Domain/Enum/MenuItemType.cs
+6
-1
VIZ.Package.Domain/Model/Menu/MenuItemModel.cs
+14
-0
VIZ.Package.Module/Login/ViewModel/LoginViewModel.cs
+5
-0
VIZ.Package.Module/Main/Core/MainTopViewMenuDataTemplateSelector.cs
+7
-0
VIZ.Package.Module/Main/View/MainTopView.xaml
+12
-1
VIZ.Package.Module/Main/View/SaveLayoutView.xaml
+1
-1
VIZ.Package.Module/Main/ViewModel/MainTopViewModel.cs
+59
-5
VIZ.Package.Module/Main/ViewModel/MainViewModel.cs
+23
-13
VIZ.Package.Module/Main/ViewModel/SaveLayoutViewModel.cs
+1
-1
VIZ.Package.Storage/Entity/ControlObject/SaveLayoutFieldEntity.cs
+25
-0
VIZ.Package.Storage/LocalDbContext.cs
+7
-0
VIZ.Package.Storage/VIZ.Package.Storage.csproj
+1
-0
No files found.
VIZ.Package.Domain/ApplicationDomainEx.cs
View file @
6aed39c7
...
...
@@ -173,5 +173,10 @@ namespace VIZ.Package.Domain
/// 时钟控件保存信息
/// </summary>
public
static
ClockFieldEntity
ClockField
{
get
;
set
;
}
/// <summary>
/// 布局保存信息
/// </summary>
public
static
SaveLayoutFieldEntity
SaveLayoutField
{
get
;
set
;
}
}
}
VIZ.Package.Domain/Enum/MenuItemType.cs
View file @
6aed39c7
...
...
@@ -24,6 +24,11 @@ namespace VIZ.Package.Domain
/// <summary>
/// 分隔线
/// </summary>
Separator
Separator
,
/// <summary>
/// 保存布局
/// </summary>
CheckBox1
}
}
VIZ.Package.Domain/Model/Menu/MenuItemModel.cs
View file @
6aed39c7
...
...
@@ -81,8 +81,22 @@ namespace VIZ.Package.Domain.Model
get
{
return
filePath
;
}
set
{
filePath
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
FilePath
));
}
}
#
endregion
/// <summary>
/// 是否勾选
/// </summary>
private
bool
isClosed
=
true
;
public
bool
IsClosed
{
get
{
return
isClosed
;
}
set
{
isClosed
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
IsClosed
));
}
}
#
region
Command
--
命令
private
VCommand
<
string
>
command
;
...
...
VIZ.Package.Module/Login/ViewModel/LoginViewModel.cs
View file @
6aed39c7
...
...
@@ -303,6 +303,11 @@ namespace VIZ.Package.Module
clockFieldEntity
=
clockFieldEntity
??
new
ClockFieldEntity
();
ApplicationDomainEx
.
ClockField
=
clockFieldEntity
;
// 布局保存存在加载数据读取
SaveLayoutFieldEntity
saveLayoutFieldEntity
=
ApplicationDomainEx
.
LocalDbContext
.
SaveLayoutField
.
FindAll
().
FirstOrDefault
();
saveLayoutFieldEntity
=
saveLayoutFieldEntity
??
new
SaveLayoutFieldEntity
();
ApplicationDomainEx
.
SaveLayoutField
=
saveLayoutFieldEntity
;
// Step 3. 加载插件信息
ApplicationDomainEx
.
PluginInfos
=
this
.
pluginService
.
LoadPluginInfos
();
...
...
VIZ.Package.Module/Main/Core/MainTopViewMenuDataTemplateSelector.cs
View file @
6aed39c7
...
...
@@ -31,6 +31,11 @@ namespace VIZ.Package.Module
public
DataTemplate
SeparatorTemplate
{
get
;
set
;
}
/// <summary>
/// 添加勾选布局类型
/// </summary>
public
DataTemplate
CheckBoxLayoutTemplate
{
get
;
set
;
}
/// <summary>
/// 选择模板
/// </summary>
/// <returns></returns>
...
...
@@ -45,6 +50,8 @@ namespace VIZ.Package.Module
case
MenuItemType
.
Button
:
return
this
.
ButtonDataTemplate
;
case
MenuItemType
.
CheckBox
:
return
this
.
CheckBoxDataTemplate
;
case
MenuItemType
.
Separator
:
return
this
.
SeparatorTemplate
;
case
MenuItemType
.
CheckBox1
:
return
this
.
CheckBoxLayoutTemplate
;
}
return
null
;
...
...
VIZ.Package.Module/Main/View/MainTopView.xaml
View file @
6aed39c7
...
...
@@ -23,7 +23,7 @@
<DataTemplate>
<ContentControl>
<dxb:BarButtonItem Glyph="{Binding Icon}" Content="{Binding Header}"
Command="{Binding Path=Command}" CommandParameter="{Binding Path=FilePath}" ></dxb:BarButtonItem>
Command="{Binding Path=Command}"
CommandParameter="{Binding Path=FilePath}" ></dxb:BarButtonItem>
</ContentControl>
</DataTemplate>
</local:MainTopViewMenuDataTemplateSelector.ButtonDataTemplate>
...
...
@@ -35,6 +35,17 @@
</ContentControl>
</DataTemplate>
</local:MainTopViewMenuDataTemplateSelector.CheckBoxDataTemplate>
<local:MainTopViewMenuDataTemplateSelector.CheckBoxLayoutTemplate>
<DataTemplate>
<ContentControl>
<dxb:BarCheckItem Content="{Binding Header}" Command="{Binding Path=Command}" CommandParameter="{Binding Path=FilePath}"
IsChecked="{Binding IsClosed,Mode=TwoWay,Converter={StaticResource Bool2BoolConverterSimple}}" >
</dxb:BarCheckItem>
</ContentControl>
</DataTemplate>
</local:MainTopViewMenuDataTemplateSelector.CheckBoxLayoutTemplate>
<local:MainTopViewMenuDataTemplateSelector.SeparatorTemplate>
<DataTemplate>
<ContentControl>
...
...
VIZ.Package.Module/Main/View/SaveLayoutView.xaml
View file @
6aed39c7
...
...
@@ -19,7 +19,7 @@
<TextBlock Text="布局名称:" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,10,0" Grid.Row="0"></TextBlock>
<TextBox Text="{Binding Path=FolderName,Mode=TwoWay}" Grid.Row="1" VerticalContentAlignment="Center" HorizontalAlignment="Left" HorizontalContentAlignment="Left"
AcceptsReturn="False"
TextWrapping="NoWrap" Height="30" Margin="10,0,10,0" Width="27
5"></TextBox>
AcceptsReturn="False"
Height="30" Margin="10,0,10,0" Width="26
5"></TextBox>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
...
...
VIZ.Package.Module/Main/ViewModel/MainTopViewModel.cs
View file @
6aed39c7
...
...
@@ -4,6 +4,7 @@ using log4net;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Security.Cryptography
;
...
...
@@ -138,6 +139,8 @@ namespace VIZ.Package.Module
#
endregion
// =====================================================================
// Command
// =====================================================================
...
...
@@ -205,6 +208,9 @@ namespace VIZ.Package.Module
items
.
Add
(
new
MenuItemModel
{
Type
=
MenuItemType
.
Separator
});
//读取文件中配置文件
if
(
Directory
.
Exists
(
path
))
{
...
...
@@ -216,9 +222,14 @@ namespace VIZ.Package.Module
menuItemModel
.
Header
=
Path
.
GetFileNameWithoutExtension
(
file
);
if
(
file
==
ApplicationDomainEx
.
SaveLayoutField
.
Path
)
{
menuItemModel
.
IsClosed
=
false
;
}
if
(
Convert
.
ToString
(
menuItemModel
.
Header
)
!=
"layout"
&&
(
Convert
.
ToString
(
menuItemModel
.
Header
)
!=
"default_layout"
))
{
menuItemModel
.
Type
=
MenuItemType
.
Button
;
menuItemModel
.
Type
=
MenuItemType
.
CheckBox1
;
menuItemModel
.
FilePath
=
file
;
menuItemModel
.
Command
=
this
.
ImportLayoutCommand
;
...
...
@@ -431,13 +442,13 @@ namespace VIZ.Package.Module
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
);
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
);
System
.
IO
.
File
.
Copy
(
sourceLogPath
,
logPath
,
true
);
}
//把新的东西保存新的库里
...
...
@@ -449,7 +460,7 @@ namespace VIZ.Package.Module
ApplicationDomainEx
.
VizConfig
.
ProjectPath
=
path
;
ApplicationDomainEx
.
LocalDbContext
.
VizConfig
.
Update
(
ApplicationDomainEx
.
VizConfig
);
this
.
ProjectName
=
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
path
);
this
.
ProjectName
=
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
path
);
// 记录操作日志
...
...
@@ -563,6 +574,17 @@ namespace VIZ.Package.Module
// 记录操作日志
this
.
recordLogService
.
AppendLog
(
ApplicationConstants
.
APPLICATION_GROUP_NAME
,
RecordLogOperate
.
Operate
,
RecordLogTrigger
.
Human
,
RecordLogConstants
.
OPERATE_SETTING_RESET_LAYOUT
);
SaveLayoutData
(
""
);
//重新设置布局
var
Items
=
this
.
ItemsSource
.
Where
(
a
=>
a
.
Type
==
MenuItemType
.
CheckBox1
).
ToObservableCollection
();
foreach
(
var
item
in
Items
)
{
item
.
IsClosed
=
true
;
}
service
.
LoadLayout
();
}
...
...
@@ -585,9 +607,41 @@ namespace VIZ.Package.Module
service
.
ImportLayout
(
param
);
//this.ItemsSource.FirstOrDefault(a => a.FilePath == param).Icon = "/VIZ.Package.Module.Resource;component/Icons/right24x244.png";
var
Items
=
this
.
ItemsSource
.
Where
(
a
=>
a
.
Type
==
MenuItemType
.
CheckBox1
).
ToObservableCollection
();
foreach
(
var
item
in
Items
)
{
if
(
item
.
FilePath
==
param
)
{
item
.
IsClosed
=
false
;
}
else
{
item
.
IsClosed
=
true
;
}
}
SaveLayoutData
(
param
);
}
/// <summary>
/// 保存布局到数据库里
/// </summary>
/// <param name="param"></param>
private
void
SaveLayoutData
(
string
param
)
{
//存放布局缓存
SaveLayoutFieldEntity
saveLayoutField
=
ApplicationDomainEx
.
SaveLayoutField
;
saveLayoutField
.
Path
=
param
;
ApplicationDomainEx
.
LocalDbContext
.
SaveLayoutField
.
Upsert
(
saveLayoutField
);
}
/// <summary>
/// 获取布局文件路径
...
...
@@ -646,7 +700,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
=>
a
.
Type
==
MenuItemType
.
CheckBox1
).
ToObservableCollection
();
managerLayout
.
ShowDialog
();
}
...
...
VIZ.Package.Module/Main/ViewModel/MainViewModel.cs
View file @
6aed39c7
...
...
@@ -184,7 +184,7 @@ namespace VIZ.Package.Module
private
void
OnApplicationClosedMessage
(
ApplicationClosedMessage
msg
)
{
// 保存布局
this
.
SaveLayout
();
//
this.SaveLayout();
}
// ============================================================
...
...
@@ -224,25 +224,35 @@ namespace VIZ.Package.Module
// 获取当前布局文件路径
string
path
=
this
.
GetLayoutPath
();
// 如果没有布局文件,那么尝试使用默认布局文件
if
(
string
.
IsNullOrWhiteSpace
(
path
)
||
!
System
.
IO
.
File
.
Exists
(
path
))
if
(
string
.
IsNullOrEmpty
(
ApplicationDomainEx
.
SaveLayoutField
.
Path
)||!
File
.
Exists
(
ApplicationDomainEx
.
SaveLayoutField
.
Path
))
{
path
=
this
.
GetDefaultLayoutPath
();
// 如果没有布局文件,那么尝试使用默认布局文件
if
(
string
.
IsNullOrWhiteSpace
(
path
)
||
!
System
.
IO
.
File
.
Exists
(
path
))
{
path
=
this
.
GetDefaultLayoutPath
();
}
// 如果没有对应插件布局文件,那么尝试使用系统默认布局文件
if
(
string
.
IsNullOrWhiteSpace
(
path
)
||
!
System
.
IO
.
File
.
Exists
(
path
))
{
path
=
System
.
IO
.
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"layout"
,
"default_layout.xml"
);
}
// 如果布局文件不存在,那么不加载布局
if
(!
System
.
IO
.
File
.
Exists
(
path
))
{
return
;
}
}
// 如果没有对应插件布局文件,那么尝试使用系统默认布局文件
if
(
string
.
IsNullOrWhiteSpace
(
path
)
||
!
System
.
IO
.
File
.
Exists
(
path
))
else
{
path
=
System
.
IO
.
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"layout"
,
"default_layout.xml"
)
;
path
=
ApplicationDomainEx
.
SaveLayoutField
.
Path
;
}
// 如果布局文件不存在,那么不加载布局
if
(!
System
.
IO
.
File
.
Exists
(
path
))
{
return
;
}
view
.
dockLayoutManager
.
RestoreLayoutFromXml
(
path
);
}
/// <summary>
...
...
VIZ.Package.Module/Main/ViewModel/SaveLayoutViewModel.cs
View file @
6aed39c7
...
...
@@ -128,7 +128,7 @@ namespace VIZ.Package.Module
service
.
ItemsSource
.
Add
(
new
Domain
.
Model
.
MenuItemModel
()
{
Header
=
FolderName
,
Type
=
MenuItemType
.
Button
,
Type
=
MenuItemType
.
CheckBox1
,
FilePath
=
createPath
,
Command
=
service
.
ImportLayoutCommand
});
...
...
VIZ.Package.Storage/Entity/ControlObject/SaveLayoutFieldEntity.cs
0 → 100644
View file @
6aed39c7
using
LiteDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Storage
{
public
class
SaveLayoutFieldEntity
{
/// <summary>
/// 编号
/// </summary>
[
BsonId
(
true
)]
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 保存路径
/// </summary>
public
string
Path
{
get
;
set
;
}
}
}
VIZ.Package.Storage/LocalDbContext.cs
View file @
6aed39c7
...
...
@@ -40,6 +40,8 @@ namespace VIZ.Package.Storage
this
.
Conn
=
this
.
Database
.
GetCollection
<
ConnEntity
>();
this
.
PluginMappingConfig
=
this
.
Database
.
GetCollection
<
PluginMappingConfigEntity
>();
this
.
ClockField
=
this
.
Database
.
GetCollection
<
ClockFieldEntity
>();
this
.
SaveLayoutField
=
this
.
Database
.
GetCollection
<
SaveLayoutFieldEntity
>();
}
/// <summary>
...
...
@@ -78,6 +80,11 @@ namespace VIZ.Package.Storage
/// </summary>
public
ILiteCollection
<
ClockFieldEntity
>
ClockField
{
get
;
private
set
;
}
/// <summary>
/// 布局保存字段
/// </summary>
public
ILiteCollection
<
SaveLayoutFieldEntity
>
SaveLayoutField
{
get
;
private
set
;
}
/// <summary>
/// 插件映射
/// </summary>
...
...
VIZ.Package.Storage/VIZ.Package.Storage.csproj
View file @
6aed39c7
...
...
@@ -104,6 +104,7 @@
<Compile Include="Entity\ControlObject\ClockFieldEntity.cs" />
<Compile Include="Entity\ControlObject\ControlFieldEntity.cs" />
<Compile Include="Entity\ControlObject\ControlObjectEntity.cs" />
<Compile Include="Entity\ControlObject\SaveLayoutFieldEntity.cs" />
<Compile Include="Entity\Page\PageEntityBase.cs" />
<Compile Include="Entity\Page\PageEntity.cs" />
<Compile Include="Entity\Page\PageGroupEntity.cs" />
...
...
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