Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Framework
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.Framework
Commits
c0ee5238
Commit
c0ee5238
authored
Dec 21, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导航配置
WindowHost容器添加渲染目标宽度与高度
parent
bce25c66
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
187 additions
and
1 deletions
+187
-1
VIZ.Framework.Common/Widgets/NavigationControl/NavigationConfig.cs
+25
-0
VIZ.Framework.Common/Widgets/NavigationControl/NavigationControl.xaml
+1
-0
VIZ.Framework.Common/Widgets/NavigationControl/NavigationItemControl.cs
+44
-0
VIZ.Framework.Common/Widgets/WindowHost/WindowHost.cs
+44
-1
VIZ.Framework.Core/Core/Converter/Bool2StringConverter.cs
+58
-0
VIZ.Framework.Core/VIZ.Framework.Core.csproj
+1
-0
VIZ.Framework.Plugin/PluginViewModelBase.cs
+14
-0
No files found.
VIZ.Framework.Common/Widgets/NavigationControl/NavigationConfig.cs
View file @
c0ee5238
...
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
VIZ.Framework.Core
;
namespace
VIZ.Framework.Common
...
...
@@ -39,5 +40,29 @@ namespace VIZ.Framework.Common
}
#
endregion
#
region
ViewModelType
--
视图模型类型
private
Type
viewModelType
;
/// <summary>
/// 视图模型类型
/// </summary>
public
Type
ViewModelType
{
get
{
return
viewModelType
;
}
set
{
viewModelType
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
ViewModelType
));
}
}
#
endregion
/// <summary>
/// 视图
/// </summary>
public
WeakReference
<
object
>
View
{
get
;
set
;
}
/// <summary>
/// 视图模型
/// </summary>
public
WeakReference
<
object
>
ViewModel
{
get
;
set
;
}
}
}
VIZ.Framework.Common/Widgets/NavigationControl/NavigationControl.xaml
View file @
c0ee5238
...
...
@@ -22,6 +22,7 @@
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Visibility" Value="{Binding Path=IsSelected,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource Bool2VisibilityConverter}}"></Setter>
<Setter Property="ViewType" Value="{Binding Path=ViewType,Mode=OneWay}"></Setter>
<Setter Property="ViewModelType" Value="{Binding Path=ViewModelType,Mode=OneWay}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:NavigationItemControl">
...
...
VIZ.Framework.Common/Widgets/NavigationControl/NavigationItemControl.cs
View file @
c0ee5238
...
...
@@ -12,6 +12,7 @@ using System.Windows.Media;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
VIZ.Framework.Core
;
namespace
VIZ.Framework.Common
{
...
...
@@ -68,6 +69,25 @@ namespace VIZ.Framework.Common
#
endregion
#
region
ViewModelType
--
视图模型类型
/// <summary>
/// 视图模型类型
/// </summary>
public
Type
ViewModelType
{
get
{
return
(
Type
)
GetValue
(
ViewModelTypeProperty
);
}
set
{
SetValue
(
ViewModelTypeProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for ViewModelType. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
ViewModelTypeProperty
=
DependencyProperty
.
Register
(
"ViewModelType"
,
typeof
(
Type
),
typeof
(
NavigationItemControl
),
new
PropertyMetadata
(
null
));
#
endregion
/// <summary>
/// 可见性改变时触发
/// </summary>
...
...
@@ -79,9 +99,33 @@ namespace VIZ.Framework.Common
if
(
this
.
Content
!=
null
&&
this
.
Content
.
GetType
()
==
this
.
ViewType
)
return
;
NavigationConfig
config
=
this
.
DataContext
as
NavigationConfig
;
if
(
this
.
ViewType
!=
null
)
{
this
.
Content
=
this
.
ViewType
.
Assembly
.
CreateInstance
(
this
.
ViewType
.
FullName
);
config
.
View
=
new
WeakReference
<
object
>(
this
.
Content
);
}
if
(
this
.
ViewModelType
!=
null
)
{
FrameworkElement
view
=
this
.
Content
as
FrameworkElement
;
if
(
view
!=
null
)
{
object
obj
=
this
.
ViewModelType
.
Assembly
.
CreateInstance
(
this
.
ViewModelType
.
FullName
);
config
.
ViewModel
=
new
WeakReference
<
object
>(
obj
);
ViewModelBase
vm
=
obj
as
ViewModelBase
;
if
(
vm
==
null
)
{
view
.
DataContext
=
obj
;
}
else
{
WPFHelper
.
BindingViewModel
(
view
,
vm
);
}
}
}
}
}
...
...
VIZ.Framework.Common/Widgets/WindowHost/WindowHost.cs
View file @
c0ee5238
...
...
@@ -64,6 +64,44 @@ namespace VIZ.Framework.Common
#
endregion
#
region
WindowAdjustWidth
--
窗口计算宽度
/// <summary>
/// 窗口计算宽度
/// </summary>
public
int
WindowAdjustWidth
{
get
{
return
(
int
)
GetValue
(
WindowAdjustWidthProperty
);
}
set
{
SetValue
(
WindowAdjustWidthProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for WindowAdjustWidth. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
WindowAdjustWidthProperty
=
DependencyProperty
.
Register
(
"WindowAdjustWidth"
,
typeof
(
int
),
typeof
(
WindowHost
),
new
PropertyMetadata
(
1920
));
#
endregion
#
region
WindowAdjustHeight
--
窗口计算高度
/// <summary>
/// 窗口计算高度
/// </summary>
public
int
WindowAdjustHeight
{
get
{
return
(
int
)
GetValue
(
WindowAdjustHeightProperty
);
}
set
{
SetValue
(
WindowAdjustHeightProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for WindowAdjustHeight. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
WindowAdjustHeightProperty
=
DependencyProperty
.
Register
(
"WindowAdjustHeight"
,
typeof
(
int
),
typeof
(
WindowHost
),
new
PropertyMetadata
(
1080
));
#
endregion
/// <summary>
/// 容器窗口句柄
/// </summary>
...
...
@@ -147,8 +185,13 @@ namespace VIZ.Framework.Common
int
width
=
(
int
)(
sizeInfo
.
NewSize
.
Width
*
(
dpi
.
X
/
96d
));
int
height
=
(
int
)(
sizeInfo
.
NewSize
.
Height
*
(
dpi
.
Y
/
96d
));
int
render_width
=
0
;
int
render_height
=
0
;
ImageHelper
.
AdjustSize
(
width
,
height
,
this
.
WindowAdjustWidth
,
this
.
WindowAdjustHeight
,
out
render_width
,
out
render_height
);
// 改变宿主窗口大小
if
(!
Win32Helper
.
MoveWindow
(
this
.
PART_ContainerForm
.
Handle
,
0
,
0
,
width
,
height
,
false
))
if
(!
Win32Helper
.
MoveWindow
(
this
.
PART_ContainerForm
.
Handle
,
(
width
-
render_width
)
/
2
,
(
height
-
render_height
)
/
2
,
render_width
,
render_
height
,
false
))
{
log
.
Error
(
"resize form error."
);
}
...
...
VIZ.Framework.Core/Core/Converter/Bool2StringConverter.cs
0 → 100644
View file @
c0ee5238
using
System
;
using
System.Collections.Generic
;
using
System.Globalization
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Data
;
namespace
VIZ.Framework.Core
{
/// <summary>
/// Bool 转 字符串转化器
/// </summary>
public
class
Bool2StringConverter
:
IValueConverter
{
/// <summary>
/// 为True时的返回值
/// </summary>
public
string
TrueResult
{
get
;
set
;
}
/// <summary>
/// 为False时的返回值
/// </summary>
public
string
FalseResult
{
get
;
set
;
}
/// <summary>
/// 为Null时的返回值
/// </summary>
public
string
NullResult
{
get
;
set
;
}
public
object
Convert
(
object
value
,
Type
targetType
,
object
parameter
,
CultureInfo
culture
)
{
if
(
value
is
bool
?)
{
bool
?
b
=
(
bool
?)
value
;
if
(
b
==
null
)
return
this
.
NullResult
;
return
b
.
Value
?
this
.
TrueResult
:
this
.
FalseResult
;
}
else
if
(
value
is
bool
)
{
bool
b
=
(
bool
)
value
;
return
b
?
this
.
TrueResult
:
this
.
FalseResult
;
}
else
{
return
this
.
NullResult
;
}
}
public
object
ConvertBack
(
object
value
,
Type
targetType
,
object
parameter
,
CultureInfo
culture
)
{
throw
new
NotImplementedException
();
}
}
}
VIZ.Framework.Core/VIZ.Framework.Core.csproj
View file @
c0ee5238
...
...
@@ -94,6 +94,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Core\Converter\Bool2BoolConverter.cs" />
<Compile Include="Core\Converter\Bool2StringConverter.cs" />
<Compile Include="Core\Converter\ByteSizeConverter.cs" />
<Compile Include="Core\Converter\Bool2SolidColorBrushConverter.cs" />
<Compile Include="Core\Converter\Color2SolidColorBrushConverter.cs" />
...
...
VIZ.Framework.Plugin/PluginViewModelBase.cs
View file @
c0ee5238
...
...
@@ -17,6 +17,20 @@ namespace VIZ.Framework.Plugin
// Property
// ==================================================================================
#
region
HasProjectDomain
--
当前是否包含项目领域
private
bool
hasProjectDomain
;
/// <summary>
/// 当前是否包含项目领域
/// </summary>
public
bool
HasProjectDomain
{
get
{
return
hasProjectDomain
;
}
set
{
hasProjectDomain
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
HasProjectDomain
));
}
}
#
endregion
// ==================================================================================
// override
// ==================================================================================
...
...
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