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
f6bf79a1
Commit
f6bf79a1
authored
May 22, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 只有 一执行ParamDictionary.SetValue 就会Save() 不再需要主动调用 Save()
parent
540d14b2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
22 deletions
+63
-22
ParamDictionary.cs
Project.FLY.Misc/MISC/ParamDictionary.cs
+3
-2
PasswordAuthorize.cs
...ect.FLY.Thick.Base/FLY.Thick.Base.UI/PasswordAuthorize.cs
+9
-5
PgCustomSections.xaml
...ct.FLY.Thick.Base/FLY.Thick.Base.UI/PgCustomSections.xaml
+0
-2
PgCustomSections.xaml.cs
...FLY.Thick.Base/FLY.Thick.Base.UI/PgCustomSections.xaml.cs
+0
-7
PgErrorAllTable.xaml.cs
...ck.Base/FLY.Thick.Base.UI/PgError/PgErrorAllTable.xaml.cs
+1
-1
WdPassword.xaml.cs
Project.FLY.Thick.Base/FLY.Thick.Base.UI/WdPassword.xaml.cs
+50
-5
No files found.
Project.FLY.Misc/MISC/ParamDictionary.cs
View file @
f6bf79a1
...
...
@@ -30,6 +30,7 @@ namespace Misc
cell
.
IsConverted
=
true
;
cells
.
Add
(
cell
);
ValueChanged
?.
Invoke
(
this
,
new
ParamDictionaryValueChangedEventArgs
()
{
Key
=
key
,
Value
=
value
});
Save
();
}
else
{
...
...
@@ -37,8 +38,8 @@ namespace Misc
if
(
cell
.
Value
!=
value
)
{
cell
.
Value
=
value
;
//cell.Type = value.GetType();
ValueChanged
?.
Invoke
(
this
,
new
ParamDictionaryValueChangedEventArgs
()
{
Key
=
key
,
Value
=
value
});
Save
();
}
}
}
...
...
@@ -181,7 +182,7 @@ namespace Misc
this
.
path
=
path
;
Load
();
}
public
void
Load
()
void
Load
()
{
if
(!
File
.
Exists
(
path
))
return
;
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PasswordAuthorize.cs
View file @
f6bf79a1
...
...
@@ -148,20 +148,24 @@ namespace FLY.Thick.Base.UI
{
this
.
jsonDist
.
SetValue
(
JSONDIST_KEY
,
JObject
.
FromObject
(
db
));
}
/// <summary>
/// 输入密码,确认密码权限是否满足要求, level越大,要求权限越大
/// </summary>
/// <param name="pw"></param>
/// <param name="level"></param>
/// <param name="pw">密码</param>
/// <param name="level">要求级别</param>
/// <param name="pw_lv">输入密码的级别</param>
/// <returns></returns>
public
AUTHORIZE_RESULT
Authorize
(
string
pw
,
int
level
)
public
AUTHORIZE_RESULT
Authorize
(
string
pw
,
int
level
,
out
int
pw_lv
)
{
pw_lv
=
0
;
if
(
level
<=
0
)
return
AUTHORIZE_RESULT
.
OK
;
var
v
=
from
p
in
Db
.
Pws
where
p
.
Password
==
pw
select
p
;
if
(
v
.
Count
()
>
0
)
{
pw_lv
=
v
.
First
().
Level
;
if
(
v
.
First
().
Level
>=
level
)
return
AUTHORIZE_RESULT
.
OK
;
else
...
...
@@ -175,9 +179,9 @@ namespace FLY.Thick.Base.UI
/// <param name="pw"></param>
/// <param name="uiName">界面名称</param>
/// <returns></returns>
public
AUTHORIZE_RESULT
Authorize
(
string
pw
,
string
uiName
)
public
AUTHORIZE_RESULT
Authorize
(
string
pw
,
string
uiName
,
out
int
pw_lv
)
{
return
Authorize
(
pw
,
GetLv
(
uiName
));
return
Authorize
(
pw
,
GetLv
(
uiName
)
,
out
pw_lv
);
}
/// <summary>
/// 获取授权级别, 0级不需要密码就能通过
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgCustomSections.xaml
View file @
f6bf79a1
...
...
@@ -28,7 +28,5 @@
<StackPanel x:Name="spSections">
</StackPanel>
</ScrollViewer>
<Button Style="{StaticResource ButtonStyle_apply}" VerticalAlignment="Bottom" Margin="0,0,20,-45"
Click="btnApplyClick"/>
</Grid>
</Page>
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgCustomSections.xaml.cs
View file @
f6bf79a1
...
...
@@ -45,12 +45,5 @@ namespace FLY.Thick.Base.UI
spSections
.
Children
.
Add
(
uc
);
}
}
private
void
btnApplyClick
(
object
sender
,
RoutedEventArgs
e
)
{
paramDictionary
.
Save
();
FLY
.
ControlLibrary
.
Window_Tip
.
Show
(
"成功"
,
""
,
TimeSpan
.
FromSeconds
(
2
));
return
;
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorAllTable.xaml.cs
View file @
f6bf79a1
...
...
@@ -51,12 +51,12 @@ namespace FLY.Thick.Base.UI
//窗口显示数据条数
int
windowSize
=
this
.
paramDictionary
.
GetValue
<
int
>(
ParamDistItemKeys
.
WindowSize
,
30
);
mWindow
=
new
BufferWindow
<
FlyData_WarningHistory
>(
this
.
warningService
.
NewestList
,
windowSize
);
mWindow
.
PropertyChanged
+=
(
s
,
e
)
=>
{
if
(
e
.
PropertyName
==
"Size"
)
{
this
.
paramDictionary
.
SetValue
(
ParamDistItemKeys
.
WindowSize
,
mWindow
.
Size
);
this
.
paramDictionary
.
Save
();
}
};
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/WdPassword.xaml.cs
View file @
f6bf79a1
...
...
@@ -38,6 +38,10 @@ namespace FLY.Thick.Base.UI
/// </summary>
int
Level
=
0
;
/// <summary>
/// 输入密码,查询到的级别
/// </summary>
public
int
PwLv
{
get
;
private
set
;
}
/// <summary>
///
/// </summary>
...
...
@@ -45,6 +49,18 @@ namespace FLY.Thick.Base.UI
/// <returns></returns>
public
static
bool
Authorize
(
string
uiName
)
{
return
Authorize
(
uiName
,
out
int
pwLv
);
}
/// <summary>
///
/// </summary>
/// <param name="uiName">界面</param>
/// <param name="pwLv">当密码正确时,密码的级别</param>
/// <returns></returns>
public
static
bool
Authorize
(
string
uiName
,
out
int
pwLv
)
{
pwLv
=
0
;
//从容器获取
var
container
=
Application
.
Current
.
Properties
[
"container"
]
as
IUnityContainer
;
if
(
container
==
null
)
...
...
@@ -52,13 +68,41 @@ namespace FLY.Thick.Base.UI
var
passwordAuthorize
=
container
.
Resolve
<
PasswordAuthorize
>();
int
level
=
passwordAuthorize
.
GetLv
(
uiName
);
if
(
level
<=
0
)
if
(
level
<=
0
)
return
true
;
WdPassword
w
=
new
WdPassword
();
w
.
Init
(
passwordAuthorize
,
level
);
w
.
Owner
=
Application
.
Current
.
MainWindow
;
bool
ret
=
(
bool
)
w
.
ShowDialog
();
pwLv
=
w
.
PwLv
;
return
ret
;
}
/// <summary>
///
/// </summary>
/// <param name="level">要求的级别</param>
/// <param name="pwLv">当密码正确时,密码的级别</param>
/// <returns></returns>
public
static
bool
Authorize
(
int
level
,
out
int
pwLv
)
{
pwLv
=
0
;
//从容器获取
var
container
=
Application
.
Current
.
Properties
[
"container"
]
as
IUnityContainer
;
if
(
container
==
null
)
return
true
;
var
passwordAuthorize
=
container
.
Resolve
<
PasswordAuthorize
>();
if
(
level
<=
0
)
return
true
;
WdPassword
w
=
new
WdPassword
();
w
.
Init
(
passwordAuthorize
,
level
);
w
.
Init
(
passwordAuthorize
,
level
);
w
.
Owner
=
Application
.
Current
.
MainWindow
;
return
(
bool
)
w
.
ShowDialog
();
bool
ret
=
(
bool
)
w
.
ShowDialog
();
pwLv
=
w
.
PwLv
;
return
ret
;
}
private
void
button_apply_Click
(
object
sender
,
RoutedEventArgs
e
)
{
...
...
@@ -70,7 +114,8 @@ namespace FLY.Thick.Base.UI
}
AUTHORIZE_RESULT
r
=
passwordAuthorize
.
Authorize
(
passwordbox
.
Password
,
Level
);
AUTHORIZE_RESULT
r
=
passwordAuthorize
.
Authorize
(
passwordbox
.
Password
,
Level
,
out
int
pwLv
);
PwLv
=
pwLv
;
switch
(
r
)
{
case
AUTHORIZE_RESULT
.
OK
:
...
...
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