Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
46208651
Commit
46208651
authored
Mar 14, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 ResetAction, 按钮按下与复位 绑定功能
parent
850d97c6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
200 additions
and
6 deletions
+200
-6
PgMeMenu.xaml.cs
MultiLayout/MainEdit/PgMeMenu/PgMeMenu.xaml.cs
+1
-1
MainWindow.xaml.cs
MultiLayout/MainWindow.xaml.cs
+6
-4
COMMON.cs
Project.FLY.ControlLibrary/FLY.ControlLibrary/COMMON.cs
+1
-1
FLY.ControlLibrary.csproj
...ntrolLibrary/FLY.ControlLibrary/FLY.ControlLibrary.csproj
+7
-0
ResetAction.cs
Project.FLY.ControlLibrary/FLY.ControlLibrary/ResetAction.cs
+185
-0
No files found.
MultiLayout/MainEdit/PgMeMenu/PgMeMenu.xaml.cs
View file @
46208651
...
@@ -146,7 +146,7 @@ namespace MultiLayout.MainEdit
...
@@ -146,7 +146,7 @@ namespace MultiLayout.MainEdit
//异常
//异常
return
;
return
;
}
}
Wd
DynAreaConfig
w
=
new
WdDynArea
Config
();
Wd
MenuConfig
w
=
new
WdMenu
Config
();
w
.
Init
(
Items
,
idx
,
manager
.
serviceNames
);
w
.
Init
(
Items
,
idx
,
manager
.
serviceNames
);
w
.
Owner
=
FLY
.
ControlLibrary
.
COMMON
.
GetWindow
(
this
);
w
.
Owner
=
FLY
.
ControlLibrary
.
COMMON
.
GetWindow
(
this
);
w
.
ShowDialog
();
w
.
ShowDialog
();
...
...
MultiLayout/MainWindow.xaml.cs
View file @
46208651
...
@@ -32,17 +32,19 @@ namespace MultiLayout
...
@@ -32,17 +32,19 @@ namespace MultiLayout
public
MainWindow
()
public
MainWindow
()
{
{
InitializeComponent
();
InitializeComponent
();
}
private
async
void
MainWindow_Loaded
(
object
sender
,
RoutedEventArgs
e
)
{
//---------------------------------------------------------
//---------------------------------------------------------
//转到进度条页面
//转到进度条页面
lp
=
new
LoadingProgress
();
lp
=
new
LoadingProgress
();
PgLoading
p
=
new
PgLoading
();
PgLoading
p
=
new
PgLoading
();
p
.
DataContext
=
lp
;
p
.
DataContext
=
lp
;
NavigationService
.
Navigate
(
p
);
NavigationService
.
Navigate
(
p
);
}
private
async
void
MainWindow_Loaded
(
object
sender
,
RoutedEventArgs
e
)
await
Task
.
Delay
(
100
);
{
await
Task
.
Delay
(
10
);
//---------------------------------------------------------
//---------------------------------------------------------
//加载 unity
//加载 unity
container
=
new
UnityContainer
();
container
=
new
UnityContainer
();
...
...
Project.FLY.ControlLibrary/FLY.ControlLibrary/COMMON.cs
View file @
46208651
...
@@ -47,7 +47,7 @@ namespace FLY.ControlLibrary
...
@@ -47,7 +47,7 @@ namespace FLY.ControlLibrary
object
dataContext
=
null
;
object
dataContext
=
null
;
do
do
{
{
if
(
dobj
.
GetType
()
==
typeof
(
FrameworkElement
)
)
if
(
dobj
is
FrameworkElement
)
{
{
dataContext
=
(
dobj
as
FrameworkElement
).
DataContext
;
dataContext
=
(
dobj
as
FrameworkElement
).
DataContext
;
if
(
dataContext
!=
null
)
if
(
dataContext
!=
null
)
...
...
Project.FLY.ControlLibrary/FLY.ControlLibrary/FLY.ControlLibrary.csproj
View file @
46208651
...
@@ -77,6 +77,7 @@
...
@@ -77,6 +77,7 @@
<Compile
Include=
"GraphScanCircular.xaml.cs"
>
<Compile
Include=
"GraphScanCircular.xaml.cs"
>
<DependentUpon>
GraphScanCircular.xaml
</DependentUpon>
<DependentUpon>
GraphScanCircular.xaml
</DependentUpon>
</Compile>
</Compile>
<Compile
Include=
"ResetAction.cs"
/>
<Compile
Include=
"UI.OSK\IVirtualKeyboard.cs"
/>
<Compile
Include=
"UI.OSK\IVirtualKeyboard.cs"
/>
<Compile
Include=
"UI.OSK\KeyboardBehavior.cs"
/>
<Compile
Include=
"UI.OSK\KeyboardBehavior.cs"
/>
<Compile
Include=
"GraphScan.xaml.cs"
>
<Compile
Include=
"GraphScan.xaml.cs"
>
...
@@ -251,6 +252,12 @@
...
@@ -251,6 +252,12 @@
<Version>
3.2.5
</Version>
<Version>
3.2.5
</Version>
</PackageReference>
</PackageReference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\..\Project.FLY.Misc\MISC\Misc.csproj"
>
<Project>
{5ee61ac6-5269-4f0f-b8fa-4334fe4a678f}
</Project>
<Name>
Misc
</Name>
</ProjectReference>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Other similar extension points exist, see Microsoft.Common.targets.
...
...
Project.FLY.ControlLibrary/FLY.ControlLibrary/ResetAction.cs
0 → 100644
View file @
46208651
using
Microsoft.Xaml.Behaviors
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Controls.Primitives
;
using
System.Windows.Input
;
namespace
FLY.ControlLibrary
{
/// <summary>
/// 后台添加功能,按钮按下 时 属性=true, 抬起属性=false
/// </summary>
public
class
ResetAction2
:
IDisposable
{
/// <summary>
/// 对象
/// </summary>
public
object
obj
;
/// <summary>
/// bool 属性
/// </summary>
public
string
propertyname
;
/// <summary>
/// 按下时为 true
/// </summary>
public
bool
pressIsTrue
;
UIElement
uIElement
;
/// <summary>
///
/// </summary>
/// <param name="uIElement"></param>
/// <param name="obj"></param>
/// <param name="propertyname"></param>
/// <param name="pressIsTrue"></param>
public
ResetAction2
(
UIElement
uIElement
,
object
obj
,
string
propertyname
,
bool
pressIsTrue
=
true
)
{
this
.
uIElement
=
uIElement
;
this
.
obj
=
obj
;
this
.
propertyname
=
propertyname
;
this
.
pressIsTrue
=
pressIsTrue
;
uIElement
.
PreviewMouseDown
+=
UIElement_PreviewMouseDown
;
uIElement
.
PreviewTouchDown
+=
UIElement_PreviewTouchDown
;
uIElement
.
PreviewMouseUp
+=
UIElement_PreviewMouseUp
;
uIElement
.
PreviewTouchUp
+=
UIElement_PreviewTouchUp
;
}
/// <summary>
///
/// </summary>
/// <param name="uIElement"></param>
/// <param name="obj"></param>
/// <param name="propertyname"></param>
/// <param name="pressIsTrue"></param>
public
ResetAction2
(
UIElement
uIElement
,
string
propertyname
,
bool
pressIsTrue
=
true
)
{
this
.
uIElement
=
uIElement
;
this
.
propertyname
=
propertyname
;
this
.
pressIsTrue
=
pressIsTrue
;
uIElement
.
PreviewMouseDown
+=
UIElement_PreviewMouseDown
;
uIElement
.
PreviewTouchDown
+=
UIElement_PreviewTouchDown
;
uIElement
.
PreviewMouseUp
+=
UIElement_PreviewMouseUp
;
uIElement
.
PreviewTouchUp
+=
UIElement_PreviewTouchUp
;
}
public
void
Dispose
()
{
uIElement
.
PreviewMouseDown
-=
UIElement_PreviewMouseDown
;
uIElement
.
PreviewTouchDown
-=
UIElement_PreviewTouchDown
;
uIElement
.
PreviewMouseUp
-=
UIElement_PreviewMouseUp
;
uIElement
.
PreviewTouchUp
-=
UIElement_PreviewTouchUp
;
}
private
void
UIElement_PreviewTouchUp
(
object
sender
,
TouchEventArgs
e
)
{
Up
();
}
private
void
UIElement_PreviewMouseUp
(
object
sender
,
MouseButtonEventArgs
e
)
{
Up
();
}
private
void
UIElement_PreviewTouchDown
(
object
sender
,
TouchEventArgs
e
)
{
Down
();
}
private
void
UIElement_PreviewMouseDown
(
object
sender
,
MouseButtonEventArgs
e
)
{
Down
();
}
bool
IsObjNull
()
{
if
(
obj
==
null
)
{
if
(
uIElement
is
FrameworkElement
)
{
obj
=
(
uIElement
as
FrameworkElement
).
DataContext
;
if
(
obj
==
null
)
return
true
;
}
else
{
return
true
;
}
}
return
false
;
}
void
Down
()
{
if
(
IsObjNull
())
return
;
if
(
pressIsTrue
)
Misc
.
PropertiesManager
.
SetValue
(
obj
,
propertyname
,
true
);
else
Misc
.
PropertiesManager
.
SetValue
(
obj
,
propertyname
,
false
);
}
void
Up
()
{
if
(
IsObjNull
())
return
;
if
(
pressIsTrue
)
Misc
.
PropertiesManager
.
SetValue
(
obj
,
propertyname
,
false
);
else
Misc
.
PropertiesManager
.
SetValue
(
obj
,
propertyname
,
true
);
}
}
/// <summary>
/// ResetAction2 的 XAML 版 ,附加行为。
/// 还没完成
/// </summary>
public
class
ResetBehavior
:
Behavior
<
UIElement
>
{
public
System
.
Windows
.
Data
.
Binding
Binding
{
get
;
set
;
}
ResetAction2
resetAction
=
null
;
public
ResetBehavior
()
{
}
protected
override
void
OnAttached
()
{
base
.
OnAttached
();
UIElement
dobj
=
AssociatedObject
;
if
(
Binding
!=
null
&&
Binding
.
Path
!=
null
)
{
if
(
Binding
.
Source
!=
null
)
{
resetAction
=
new
ResetAction2
(
dobj
,
Binding
.
Source
,
Binding
.
Path
.
Path
);
}
else
{
var
obj
=
COMMON
.
GetDataContext
(
dobj
);
if
(
obj
==
null
)
{
resetAction
=
new
ResetAction2
(
dobj
,
Binding
.
Path
.
Path
);
}
else
{
resetAction
=
new
ResetAction2
(
dobj
,
obj
,
Binding
.
Path
.
Path
);
}
}
}
}
protected
override
void
OnDetaching
()
{
base
.
OnDetaching
();
if
(
resetAction
!=
null
)
{
resetAction
.
Dispose
();
resetAction
=
null
;
}
}
}
}
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