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
8aa14ee6
Commit
8aa14ee6
authored
Jan 04, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片编辑支持
parent
5dd7ad70
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
254 additions
and
15 deletions
+254
-15
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ImageEdit/ImageEditPanelModel.cs
+51
-10
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/BooleanListCellEdit.xaml
+1
-1
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/ImageListCellEdit.xaml
+26
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/ImageListCellEdit.xaml.cs
+115
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/ListEditPanel.xaml
+1
-1
VIZ.Package.Module/ControlObject/FieldEdit/Edit/TextEdit/TextEditPanelModel.cs
+1
-1
VIZ.Package.Module/ControlObject/FieldEdit/View/FieldEditWindow.xaml
+1
-1
VIZ.Package.Module/Resource/GHResource/Core/GHResourceFileDoubleClickEventArgs.cs
+20
-0
VIZ.Package.Module/Resource/GHResource/View/GHResourcePanel.xaml
+7
-1
VIZ.Package.Module/Resource/GHResource/ViewModel/GHResourcePanelModel.cs
+23
-0
VIZ.Package.Module/VIZ.Package.Module.csproj
+8
-0
No files found.
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ImageEdit/ImageEditPanelModel.cs
View file @
8aa14ee6
using
System
;
using
System.Collections.Generic
;
using
System.Dynamic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
...
...
@@ -17,7 +18,7 @@ namespace VIZ.Package.Module
public
ImageEditPanelModel
()
{
this
.
GHResourceEditPartModel
.
FilterResourceFileType
=
ResourceFileType
.
IMAGE
;
this
.
GHResourceEditPartModel
.
On
SelectedFileModelChanged
+=
GHResourceEditPartModel_OnSelectedFileModelChanged
;
this
.
GHResourceEditPartModel
.
On
FileDoubleClick
+=
GHResourceEditPartModel_OnFileDoubleClick
;
// 初始化命令
this
.
InitCommand
();
...
...
@@ -106,7 +107,27 @@ namespace VIZ.Package.Module
{
base
.
Update
(
controlObject
,
controlField
);
this
.
IsSendToPreview
=
false
;
this
.
Path
=
controlField
?.
Value
;
this
.
IsSendToPreview
=
true
;
}
/// <summary>
/// 更新动态数据
/// </summary>
/// <param name="listCellEdit">列单元格编辑器</param>
/// <param name="columnDefinition">列定义</param>
/// <param name="rowHandle">行号</param>
/// <param name="row">行数据</param>
public
override
void
UpdateDynamic
(
ListCellEditBase
listCellEdit
,
GridColumnDefinition
columnDefinition
,
int
rowHandle
,
ExpandoObject
row
)
{
base
.
UpdateDynamic
(
listCellEdit
,
columnDefinition
,
rowHandle
,
row
);
IDictionary
<
string
,
object
>
dic
=
row
as
IDictionary
<
string
,
object
>;
this
.
IsSendToPreview
=
false
;
this
.
Path
=
dic
?[
columnDefinition
.
FieldName
]?.
ToString
();
this
.
IsSendToPreview
=
true
;
}
// =====================================================================
...
...
@@ -130,21 +151,41 @@ namespace VIZ.Package.Module
if
(
this
.
ControlObject
==
null
||
this
.
ControlField
==
null
)
return
;
this
.
ControlField
.
Value
=
this
.
Path
;
if
(
this
.
FieldEditMode
==
FieldEditMode
.
Normal
)
{
this
.
ControlField
.
Value
=
this
.
Path
;
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
return
;
}
// 没有列信息或行数据
if
(
this
.
ColumnDefinition
==
null
||
this
.
Row
==
null
)
return
;
// 动态模式编辑
if
(
this
.
FieldEditMode
==
FieldEditMode
.
Dynamic
)
{
IDictionary
<
string
,
object
>
dic
=
this
.
Row
as
IDictionary
<
string
,
object
>;
dic
[
this
.
ColumnDefinition
.
FieldName
]
=
this
.
Path
;
this
.
ListCellEdit
.
UpdateEditValue
(
this
.
ColumnDefinition
,
this
.
RowHandle
,
this
.
Row
);
return
;
}
}
/// <summary>
/// GH库
文件选择改变
时触发
/// GH库
双击文件
时触发
/// </summary>
private
void
GHResourceEditPartModel_On
SelectedFileModelChanged
(
object
sender
,
GHResourceSelectedFileChanged
EventArgs
e
)
private
void
GHResourceEditPartModel_On
FileDoubleClick
(
object
sender
,
GHResourceFileDoubleClick
EventArgs
e
)
{
if
(
e
.
File
==
null
||
string
.
IsNullOrWhiteSpace
(
e
.
File
.
ResourcePath
)
)
if
(
e
.
File
==
null
)
return
;
this
.
Path
=
e
.
File
?.
ResourcePath
;
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/BooleanListCellEdit.xaml
View file @
8aa14ee6
...
...
@@ -16,6 +16,6 @@
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="200">
<Grid>
<dxe:CheckEdit x:Name="PART_Check" EditValueChanged="EditValueChanged"></dxe:CheckEdit>
<dxe:CheckEdit x:Name="PART_Check" EditValueChanged="EditValueChanged"
Margin="10,0,0,0" HorizontalAlignment="Left"
></dxe:CheckEdit>
</Grid>
</local:ListCellEditBase>
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/ImageListCellEdit.xaml
0 → 100644
View file @
8aa14ee6
<local:ListCellEditBase x:Class="VIZ.Package.Module.ImageListCellEdit"
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:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:storage="clr-namespace:VIZ.Package.Storage;assembly=VIZ.Package.Storage"
xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
xmlns:local="clr-namespace:VIZ.Package.Module"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="200">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="30"></ColumnDefinition>
</Grid.ColumnDefinitions>
<dxe:TextEdit x:Name="PART_Text" IsReadOnly="True" EditValueChanged="EditValueChanged"></dxe:TextEdit>
<Button x:Name="PART_Show" Content=".." Grid.Column="1" Click="EditClick"></Button>
</Grid>
</local:ListCellEditBase>
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/ImageListCellEdit.xaml.cs
0 → 100644
View file @
8aa14ee6
using
System
;
using
System.Collections.Generic
;
using
System.Dynamic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
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.Package.Domain
;
using
VIZ.Package.Service
;
namespace
VIZ.Package.Module
{
/// <summary>
/// ImageListCellEdit.xaml 的交互逻辑
/// </summary>
public
partial
class
ImageListCellEdit
:
ListCellEditBase
{
public
ImageListCellEdit
()
{
InitializeComponent
();
}
/// <summary>
/// 数据上下文改变时触发
/// </summary>
/// <param name="e">事件参数</param>
protected
override
void
OnDataContextChanged
(
DependencyPropertyChangedEventArgs
e
)
{
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
cellData
=
e
.
NewValue
as
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
;
this
.
IsSendToPreview
=
false
;
this
.
PART_Text
.
EditValue
=
cellData
?.
Value
?.
ToString
();
this
.
IsSendToPreview
=
true
;
}
/// <summary>
/// 值改变时触发
/// </summary>
private
void
EditValueChanged
(
object
sender
,
DevExpress
.
Xpf
.
Editors
.
EditValueChangedEventArgs
e
)
{
// 是否需要发送至预览
if
(!
this
.
IsSendToPreview
)
return
;
// 预览连接不存在
if
(
ApplicationDomainEx
.
PreviewConn
==
null
)
return
;
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
cellData
=
this
.
DataContext
as
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
;
if
(
cellData
==
null
)
return
;
GridColumnDefinition
columnDefinition
=
cellData
.
Column
.
DataContext
as
GridColumnDefinition
;
if
(
columnDefinition
==
null
)
return
;
// 向Viz发送指令
this
.
VizCommandControlObjectService
.
SetControlObjectListValue
(
ApplicationDomainEx
.
PreviewConn
,
columnDefinition
.
ControlObject
.
TreeNodePath
,
columnDefinition
.
ControlField
.
FieldIdentifier
,
cellData
.
RowData
.
RowHandle
.
Value
,
columnDefinition
.
FieldName
,
e
.
NewValue
?.
ToString
()
??
string
.
Empty
);
}
/// <summary>
/// 显示编辑窗口
/// </summary>
private
void
EditClick
(
object
sender
,
RoutedEventArgs
e
)
{
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
cellData
=
this
.
DataContext
as
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
;
if
(
cellData
==
null
)
return
;
GridColumnDefinition
columnDefinition
=
cellData
.
Column
.
DataContext
as
GridColumnDefinition
;
if
(
columnDefinition
==
null
)
return
;
FieldEditWindow
window
=
this
.
GetFieldEditWindow
();
FieldEditWindowModel
vm
=
window
.
DataContext
as
FieldEditWindowModel
;
vm
.
Update
(
this
,
columnDefinition
,
cellData
.
RowData
.
RowHandle
.
Value
,
cellData
.
Row
as
ExpandoObject
);
window
.
ShowInTaskbar
=
true
;
window
.
Visibility
=
Visibility
.
Visible
;
}
/// <summary>
/// 更新
/// </summary>
/// <param name="columnDefinition">列定义</param>
/// <param name="rowHandle">行号</param>
/// <param name="row">行数据</param>
public
override
void
UpdateEditValue
(
GridColumnDefinition
columnDefinition
,
int
rowHandle
,
ExpandoObject
row
)
{
IDictionary
<
string
,
object
>
dic
=
row
as
IDictionary
<
string
,
object
>;
if
(
dic
==
null
)
{
this
.
PART_Text
.
EditValue
=
null
;
return
;
}
this
.
PART_Text
.
EditValue
=
dic
[
columnDefinition
.
FieldName
].
ToString
();
}
}
}
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/ListEditPanel.xaml
View file @
8aa14ee6
...
...
@@ -30,7 +30,7 @@
</local:ListEditPanelCellTemplateSelector.BooleanDataTemplate>
<local:ListEditPanelCellTemplateSelector.ImageDataTemplate>
<DataTemplate>
<local:ImageListCellEdit></local:ImageListCellEdit>
</DataTemplate>
</local:ListEditPanelCellTemplateSelector.ImageDataTemplate>
</local:ListEditPanelCellTemplateSelector>
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/TextEdit/TextEditPanelModel.cs
View file @
8aa14ee6
...
...
@@ -74,7 +74,7 @@ namespace VIZ.Package.Module
IDictionary
<
string
,
object
>
dic
=
row
as
IDictionary
<
string
,
object
>;
this
.
IsSendToPreview
=
false
;
this
.
Text
=
dic
==
null
?
null
:
dic
[
columnDefinition
.
FieldName
]?.
ToString
();
this
.
Text
=
dic
?
[
columnDefinition
.
FieldName
]?.
ToString
();
this
.
IsSendToPreview
=
true
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/View/FieldEditWindow.xaml
View file @
8aa14ee6
...
...
@@ -10,7 +10,7 @@
d:DataContext="{d:DesignInstance Type=local:FieldEditWindowModel}"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="列表字段编辑"
Width="
600" Height="45
0">
Width="
1000" Height="60
0">
<common:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}"
SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></common:NavigationControl>
...
...
VIZ.Package.Module/Resource/GHResource/Core/GHResourceFileDoubleClickEventArgs.cs
0 → 100644
View file @
8aa14ee6
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Package.Domain
;
namespace
VIZ.Package.Module
{
/// <summary>
/// GH资源选择文件双击事件参数
/// </summary>
public
class
GHResourceFileDoubleClickEventArgs
:
EventArgs
{
/// <summary>
/// 文件
/// </summary>
public
GHResourceFileModel
File
{
get
;
set
;
}
}
}
VIZ.Package.Module/Resource/GHResource/View/GHResourcePanel.xaml
View file @
8aa14ee6
...
...
@@ -57,8 +57,11 @@
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False"
ContextMenu="{Binding Path=FileContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}"
CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}"
ItemsSource="{Binding Path=FileModels}"
ItemsSource="{Binding Path=FileModels}"
SelectedItem="{Binding Path=SelectedFileModel,Mode=TwoWay}">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="MouseDoubleClick" Command="{Binding Path=FileDoubleClickCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxg:GridControl.Resources>
<!-- 定义Card模板 -->
<DataTemplate x:Key="CardTemplate">
...
...
@@ -91,6 +94,9 @@
SearchColumns="Name"
NavigationStyle="Row"
CardTemplate="{StaticResource CardTemplate}"/>
</dxg:GridControl.View>
</dxg:GridControl>
...
...
VIZ.Package.Module/Resource/GHResource/ViewModel/GHResourcePanelModel.cs
View file @
8aa14ee6
...
...
@@ -45,6 +45,7 @@ namespace VIZ.Package.Module
this
.
RefreshFolderCommand
=
new
VCommand
(
this
.
RefreshFolder
);
this
.
RefreshFileCommand
=
new
VCommand
(
this
.
RefreshFile
);
this
.
FileFilterCommand
=
new
VCommand
<
ResourceFileType
>(
this
.
FileFilter
);
this
.
FileDoubleClickCommand
=
new
VCommand
(
this
.
FileDoubleClick
);
}
/// <summary>
...
...
@@ -65,6 +66,11 @@ namespace VIZ.Package.Module
/// </summary>
public
event
EventHandler
<
GHResourceSelectedFileChangedEventArgs
>
OnSelectedFileModelChanged
;
/// <summary>
/// 文件双击时触发
/// </summary>
public
event
EventHandler
<
GHResourceFileDoubleClickEventArgs
>
OnFileDoubleClick
;
// ==================================================================================
// Property
// ==================================================================================
...
...
@@ -300,6 +306,23 @@ namespace VIZ.Package.Module
#
endregion
#
region
FileDoubleClickCommand
--
文件双击命令
/// <summary>
/// 文件双击命令
/// </summary>
public
VCommand
FileDoubleClickCommand
{
get
;
set
;
}
/// <summary>
/// 文件双击
/// </summary>
private
void
FileDoubleClick
()
{
this
.
OnFileDoubleClick
?.
Invoke
(
this
,
new
GHResourceFileDoubleClickEventArgs
{
File
=
this
.
SelectedFileModel
});
}
#
endregion
// ==================================================================================
// Public Function
// ==================================================================================
...
...
VIZ.Package.Module/VIZ.Package.Module.csproj
View file @
8aa14ee6
...
...
@@ -98,6 +98,9 @@
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\CellEdit\BooleanListCellEdit.xaml.cs">
<DependentUpon>BooleanListCellEdit.xaml</DependentUpon>
</Compile>
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\CellEdit\ImageListCellEdit.xaml.cs">
<DependentUpon>ImageListCellEdit.xaml</DependentUpon>
</Compile>
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\ListCellEditBase.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\ListEditPanelCellTemplateSelector.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\ListEditPanelModel.cs" />
...
...
@@ -139,6 +142,7 @@
<Compile Include="Plugin\View\PluginView.xaml.cs">
<DependentUpon>PluginView.xaml</DependentUpon>
</Compile>
<Compile Include="Resource\GHResource\Core\GHResourceFileDoubleClickEventArgs.cs" />
<Compile Include="Resource\GHResource\Core\GHResourceSelectedFileChangedEventArgs.cs" />
<Compile Include="Resource\MediaResource\MediaResourcePluginLifeCycle.cs" />
<Compile Include="Resource\MediaResource\ViewModel\MediaResourceViewModel.cs" />
...
...
@@ -243,6 +247,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ControlObject\FieldEdit\Edit\ListEdit\CellEdit\ImageListCellEdit.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Control\View\ControlView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
...
...
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