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
7bc1dcf7
Commit
7bc1dcf7
authored
May 12, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 全局 Page页面队列。 因为解决不了Page页面不会释放问题
parent
f551821f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
FlyLayoutManager.cs
MultiLayout/FlyLayoutManager.cs
+19
-0
MainWindow.xaml.cs
MultiLayout/MainWindow.xaml.cs
+10
-3
No files found.
MultiLayout/FlyLayoutManager.cs
View file @
7bc1dcf7
...
...
@@ -26,6 +26,25 @@ namespace MultiLayout
}
}
/// <summary>
/// 全局page, 资源永远不释放
/// </summary>
public
static
Dictionary
<
string
,
Page
>
AllPages
=
new
Dictionary
<
string
,
Page
>();
public
static
Page
GetPage
(
string
pageName
,
Func
<
Page
>
createPageHandler
)
{
Page
p
;
if
(
AllPages
.
ContainsKey
(
pageName
))
{
p
=
AllPages
[
pageName
];
}
else
{
p
=
createPageHandler
();
AllPages
.
Add
(
pageName
,
p
);
}
return
p
;
}
NLog
.
ILogger
logger
=
NLog
.
LogManager
.
GetCurrentClassLogger
();
...
...
MultiLayout/MainWindow.xaml.cs
View file @
7bc1dcf7
...
...
@@ -84,9 +84,8 @@ namespace MultiLayout
var
page
=
await
manager
.
LoadModule
();
NavigationService
.
Navigate
(
page
);
page
.
Loaded
+=
(
s
,
e1
)
=>
frame
.
NavigationService
.
RemoveBackEntry
();
//加载主页面后 删除 PgLoading 页面
page
.
Loaded
+=
Page_Loaded
;
//---------------------------------------------------------
//初始化
await
manager
.
OnInit
();
...
...
@@ -104,6 +103,14 @@ namespace MultiLayout
}
private
void
Page_Loaded
(
object
sender
,
RoutedEventArgs
e
)
{
var
page
=
sender
as
Page
;
page
.
Loaded
-=
Page_Loaded
;
NavigationService
.
RemoveBackEntry
();
}
private
void
btnErrMsgClick
(
object
sender
,
RoutedEventArgs
e
)
{
manager
.
ErrMsgClick
?.
Invoke
();
...
...
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