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
ba3d1ae8
Commit
ba3d1ae8
authored
Feb 22, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
右键菜单优化
parent
7f33b1bd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
101 additions
and
14 deletions
+101
-14
VIZ.Package.Common/VIZ.Package.Common.csproj
+1
-0
VIZ.Package.Common/Widgets/ContextMenuEx/ContextMenuEx.cs
+64
-0
VIZ.Package.Domain/Model/Page/PageModel.cs
+13
-0
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModel.cs
+1
-3
VIZ.Package.Module/Page/Group/Controller/PageModelCopyController.cs
+3
-2
VIZ.Package.Module/Page/Group/View/PageGroupView.xaml
+7
-1
VIZ.Package.Module/Page/Group/View/PageGroupView.xaml.cs
+2
-1
VIZ.Package.Module/Page/Group/ViewModel/PageGroupViewModel.cs
+10
-7
No files found.
VIZ.Package.Common/VIZ.Package.Common.csproj
View file @
ba3d1ae8
...
...
@@ -106,6 +106,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Widgets\ContextMenuEx\ContextMenuEx.cs" />
<Compile Include="Widgets\GridControlEx\ColumnDefintionGeneratorTemplate.cs" />
<Compile Include="Widgets\GridControlEx\ColumnDefintionGeneratorTemplateCollection.cs" />
<Compile Include="Widgets\GridControlEx\ColumnDefintionGeneratorTemplateSelector.cs" />
...
...
VIZ.Package.Common/Widgets/ContextMenuEx/ContextMenuEx.cs
0 → 100644
View file @
ba3d1ae8
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
VIZ.Framework.Core
;
namespace
VIZ.Package.Common
{
/// <summary>
/// 右键菜单扩展
/// </summary>
public
class
ContextMenuEx
:
ContextMenu
{
#
region
BindingTargetType
--
绑定目标类型
/// <summary>
/// 绑定目标类型
/// </summary>
public
Type
BindingTargetType
{
get
{
return
(
Type
)
GetValue
(
BindingTargetTypeProperty
);
}
set
{
SetValue
(
BindingTargetTypeProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for BindingTargetType. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
BindingTargetTypeProperty
=
DependencyProperty
.
Register
(
"BindingTargetType"
,
typeof
(
Type
),
typeof
(
ContextMenuEx
),
new
PropertyMetadata
(
null
));
#
endregion
/// <summary>
/// 是否已经完成绑定
/// </summary>
private
bool
IsBinding
;
protected
override
void
OnOpened
(
RoutedEventArgs
e
)
{
base
.
OnOpened
(
e
);
if
(
this
.
IsBinding
)
return
;
this
.
IsBinding
=
true
;
if
(
this
.
BindingTargetType
==
null
)
return
;
FrameworkElement
src
=
this
.
PlacementTarget
as
FrameworkElement
;
if
(
src
==
null
)
return
;
FrameworkElement
target
=
WPFHelper
.
GetAncestorByType
(
src
,
this
.
BindingTargetType
)
as
FrameworkElement
;
if
(
target
==
null
)
return
;
this
.
DataContext
=
target
.
DataContext
;
}
}
}
VIZ.Package.Domain/Model/Page/PageModel.cs
View file @
ba3d1ae8
...
...
@@ -133,5 +133,18 @@ namespace VIZ.Package.Domain
}
#
endregion
// =============================================================
// 扩展方法
// =============================================================
/// <summary>
/// 获取页号字符串
/// </summary>
/// <returns>页号字符串</returns>
public
string
GetPageNumString
()
{
return
string
.
Format
(
"{0:D4}"
,
this
.
PageNum
);
}
}
}
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModel.cs
View file @
ba3d1ae8
...
...
@@ -164,8 +164,6 @@ namespace VIZ.Package.Module
// 保存
this
.
controlObjectService
.
SaveControlFields
(
ApplicationDomainEx
.
CurrentPage
,
obj
.
AllFiledNodes
);
DXMessageBox
.
Show
(
"保存成功!"
);
}
#
endregion
...
...
@@ -228,7 +226,7 @@ namespace VIZ.Package.Module
this
.
Scene
=
msg
.
Page
?.
Scene
;
if
(
msg
.
Page
is
PageModel
page
)
{
this
.
PageID
=
string
.
Format
(
"{0:D4}"
,
page
.
PageNum
);
this
.
PageID
=
page
.
GetPageNumString
(
);
}
else
{
...
...
VIZ.Package.Module/Page/Group/Controller/PageModelCopyController.cs
View file @
ba3d1ae8
using
System
;
using
DevExpress.Xpf.Editors.Helpers
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -72,7 +73,7 @@ namespace VIZ.Package.Module
page
.
ThumbnailBitmap
=
template
.
ThumbnailBitmap
;
page
.
PluginID
=
vm
.
SelectedTemplatePlugin
?.
ID
;
page
.
PluginName
=
vm
.
SelectedTemplatePlugin
?.
Name
;
page
.
PageNum
=
pageGroup
.
Pages
.
Count
==
0
?
1
:
(
pageGroup
.
Pages
.
Max
(
p
=>
p
.
PageNum
)
+
1
);
page
.
PageNum
=
pageGroup
.
Pages
.
Count
==
0
?
1
:
(
pageGroup
.
Pages
.
Max
OrDefault
(
p
=>
p
.
PageNum
)
+
1
);
// 关联连接分组
ConnGroupModel
conn
=
ApplicationDomainEx
.
ConnGroups
?.
FirstOrDefault
(
p
=>
p
.
IsDefault
);
...
...
VIZ.Package.Module/Page/Group/View/PageGroupView.xaml
View file @
ba3d1ae8
...
...
@@ -269,6 +269,12 @@
SelectedItems="{Binding Path=SelectedPages}"
ColumnsSource="{Binding ElementName=uc, Path=DataContext.Columns}"
ColumnGeneratorTemplateSelector="{StaticResource ResourceKey=ColumnDefintionGeneratorTemplateSelector}">
<dxg:GridControl.ContextMenu>
<common:ContextMenuEx BindingTargetType="{x:Type dx:DXTabControl}">
<MenuItem Header="粘贴选中页" Command="{Binding Path=DataContext.PastePageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type common:ContextMenuEx}}}"/>
</common:ContextMenuEx>
</dxg:GridControl.ContextMenu>
<dxg:GridControl.View>
<dxg:TableView IsColumnMenuEnabled="True" ScrollAnimationMode="EaseInOut" AllowScrollAnimation="True"
IsColumnChooserVisible="{Binding ElementName=uc, Path=DataContext.IsColumnChooserVisible,Mode=TwoWay}"
...
...
@@ -302,7 +308,7 @@
Command="{Binding ElementName=uc,Path=DataContext.TakeInitCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarItemLinkSeparator />
<dxb:BarButtonItem Name="CopyPage" Content="
拷贝
选中页"
<dxb:BarButtonItem Name="CopyPage" Content="
复制
选中页"
Command="{Binding ElementName=uc,Path=DataContext.BeginCopyPageCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarButtonItem Name="PastePage" Content="粘贴选中页"
...
...
VIZ.Package.Module/Page/Group/View/PageGroupView.xaml.cs
View file @
ba3d1ae8
using
DevExpress.Xpf.Grid
;
using
DevExpress.Xpf.Core
;
using
DevExpress.Xpf.Grid
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
VIZ.Package.Module/Page/Group/ViewModel/PageGroupViewModel.cs
View file @
ba3d1ae8
...
...
@@ -16,6 +16,7 @@ using VIZ.Package.Domain;
using
VIZ.Package.Common
;
using
VIZ.Package.Service
;
using
VIZ.Package.Storage
;
using
DevExpress.Xpf.Editors.Helpers
;
namespace
VIZ.Package.Module
{
...
...
@@ -365,7 +366,8 @@ namespace VIZ.Package.Module
if
(
this
.
SelectedPageGroupModel
.
SelectedPages
==
null
||
this
.
SelectedPageGroupModel
.
Pages
.
Count
==
0
)
return
;
if
(
DXMessageBox
.
Show
(
$"是否删除项"
,
"提示"
,
MessageBoxButton
.
YesNo
)
!=
MessageBoxResult
.
Yes
)
string
pageNums
=
string
.
Join
(
" ,"
,
this
.
SelectedPageGroupModel
.
SelectedPages
.
Select
(
p
=>
p
.
GetPageNumString
()));
if
(
DXMessageBox
.
Show
(
$"是否删除页 [
{
pageNums
}
] ?"
,
"提示"
,
MessageBoxButton
.
YesNo
)
!=
MessageBoxResult
.
Yes
)
return
;
List
<
PageModel
>
pages
=
this
.
SelectedPageGroupModel
.
Pages
.
ToList
();
...
...
@@ -618,7 +620,7 @@ namespace VIZ.Package.Module
if
(
destGroup
==
null
)
return
;
destGroup
.
Order
=
this
.
PageGroupModels
.
Max
(
p
=>
p
.
Order
)
+
1
;
destGroup
.
Order
=
this
.
PageGroupModels
.
Max
OrDefault
(
p
=>
p
.
Order
)
+
1
;
this
.
PageGroupModels
.
Add
(
destGroup
);
this
.
pageModelController
.
BeginDownLoadIamge
(
destGroup
.
Pages
.
ToList
<
PageModelBase
>());
...
...
@@ -695,12 +697,13 @@ namespace VIZ.Package.Module
if
(
this
.
pageModelCopyController
.
WaitCopyPages
==
null
||
this
.
pageModelCopyController
.
WaitCopyPages
.
Count
==
0
)
return
;
int
maxPageNum
=
this
.
SelectedPageGroupModel
.
Pages
.
Max
(
p
=>
p
.
PageNum
);
int
maxOrder
=
this
.
SelectedPageGroupModel
.
Pages
.
Max
(
p
=>
p
.
Order
);
int
maxPageNum
=
this
.
SelectedPageGroupModel
.
Pages
.
Max
OrDefault
(
p
=>
p
.
PageNum
);
int
maxOrder
=
this
.
SelectedPageGroupModel
.
Pages
.
Max
OrDefault
(
p
=>
p
.
Order
);
foreach
(
PageModel
srcPage
in
this
.
pageModelCopyController
.
WaitCopyPages
)
{
PageModel
destPage
=
this
.
pageModelCopyController
.
CopyPage
(
srcPage
);
// 分组
PageModel
destPage
=
this
.
pageModelCopyController
.
CopyPage
(
srcPage
);
// 分组
destPage
.
PageGroupID
=
this
.
SelectedPageGroupModel
.
GroupID
;
destPage
.
PageNum
=
++
maxPageNum
;
destPage
.
Order
=
++
maxOrder
;
...
...
@@ -841,7 +844,7 @@ namespace VIZ.Package.Module
// 根据模板拷贝页
PageModel
destPage
=
this
.
pageModelCopyController
.
CopyPage
(
template
,
vm
,
this
.
SelectedPageGroupModel
);
// 页码
destPage
.
PageNum
=
this
.
SelectedPageGroupModel
.
Pages
.
Count
==
0
?
1
:
(
this
.
SelectedPageGroupModel
.
Pages
.
Max
(
p
=>
p
.
PageNum
)
+
1
)
;
destPage
.
PageNum
=
this
.
SelectedPageGroupModel
.
Pages
.
MaxOrDefault
(
p
=>
p
.
PageNum
)
+
1
;
// 添加页
this
.
SelectedPageGroupModel
.
Pages
.
Add
(
destPage
);
...
...
@@ -864,7 +867,7 @@ namespace VIZ.Package.Module
return
null
;
PageModel
destPage
=
this
.
pageModelCopyController
.
CopyPage
(
srcPage
);
destPage
.
PageNum
=
this
.
SelectedPageGroupModel
.
Pages
.
Max
(
p
=>
p
.
PageNum
)
+
1
;
destPage
.
PageNum
=
this
.
SelectedPageGroupModel
.
Pages
.
Max
OrDefault
(
p
=>
p
.
PageNum
)
+
1
;
// 添加页
this
.
SelectedPageGroupModel
.
Pages
.
Add
(
destPage
);
...
...
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