Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
G
GS.Terminal.VisitorSelfService
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
终端组
GS.Terminal.VisitorSelfService
Commits
290dc647
Commit
290dc647
authored
Aug 04, 2020
by
姜春辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登记结果页完成
parent
c399aa0d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
8 deletions
+113
-8
HistoryAppointmentPageHandler.cs
...orSelfService.Logic/Core/HistoryAppointmentPageHandler.cs
+4
-0
SubmitVisitInfoResultHandler.cs
...torSelfService.Logic/Core/SubmitVisitInfoResultHandler.cs
+53
-1
WebApi.cs
...gic/GS.Terminal.VisitorSelfService.Logic/Remote/WebApi.cs
+25
-3
ViewModel.cs
...lView/ViewModels/Pages/SubmitVisitInfoResult/ViewModel.cs
+27
-2
Index.xaml
...iewModelView/Views/Pages/SubmitVisitInfoResult/Index.xaml
+4
-2
No files found.
Src/GS.Terminal.VisitorSelfService/Logic/GS.Terminal.VisitorSelfService.Logic/Core/HistoryAppointmentPageHandler.cs
View file @
290dc647
...
...
@@ -10,6 +10,7 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
public
class
HistoryAppointmentPageHandler
:
Corebase
<
ViewModels
.
Pages
.
HistoryAppointmentPage
.
ViewModel
>
{
private
IViewModel
_BackView
;
private
string
_idnum
;
public
override
void
Init
()
{
...
...
@@ -17,8 +18,11 @@ namespace GS.Terminal.VisitorSelfService.Logic.Core
public
void
ShowView
(
string
idnum
,
IViewModel
backview
=
null
)
{
_idnum
=
idnum
;
_BackView
=
backview
;
ShowView
();
}
}
}
Src/GS.Terminal.VisitorSelfService/Logic/GS.Terminal.VisitorSelfService.Logic/Core/SubmitVisitInfoResultHandler.cs
View file @
290dc647
using
System
;
using
GS.Unitive.Framework.Utils.Serializing
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
GS.Terminal.VisitorSelfService.Logic.Core
{
public
class
SubmitVisitInfoResultHandler
:
Corebase
<
ViewModels
.
Pages
.
SubmitVisitInfoResult
.
ViewModel
>
{
private
const
int
AUTODELAY
=
5
;
private
Task
_task
;
private
CancellationTokenSource
_CTS
;
public
override
void
Init
()
{
VM
.
OnGoHomeClicked
+=
VM_OnGoHomeClicked
;
VM
.
OnNavigateInto
+=
VM_OnNavigateInto
;
VM
.
OnNavigateOut
+=
VM_OnNavigateOut
;
}
private
void
VM_OnNavigateOut
(
LogicShell
.
Interface
.
IViewModel
obj
)
{
StopDowncount
();
}
private
void
VM_OnNavigateInto
(
LogicShell
.
Interface
.
IViewModel
obj
)
{
StartDowncount
();
}
private
void
VM_OnGoHomeClicked
()
{
gohome
();
}
private
void
gohome
()
{
ThirdAddon
.
LogicShell
.
ShowView
(
vmLocator
.
MenuPage
);
}
private
void
StartDowncount
()
{
_CTS
=
new
CancellationTokenSource
();
_task
=
Task
.
Factory
.
StartNew
(
async
()
=>
{
VM
.
Downcount
=
AUTODELAY
;
while
(!
_CTS
.
IsCancellationRequested
&&
VM
.
Downcount
>
0
)
{
await
Task
.
Delay
(
1000
);
VM
.
Downcount
--;
}
if
(
VM
.
Downcount
==
0
)
gohome
();
},
_CTS
.
Token
);
}
private
void
StopDowncount
()
{
_CTS
.
Cancel
();
while
(
_task
.
Status
==
TaskStatus
.
Running
)
Task
.
Delay
(
100
).
Wait
();
_task
=
null
;
}
}
}
Src/GS.Terminal.VisitorSelfService/Logic/GS.Terminal.VisitorSelfService.Logic/Remote/WebApi.cs
View file @
290dc647
...
...
@@ -38,12 +38,20 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
{
Program
.
_Context
.
Logger
.
Error
(
$"请求服务[
{
service
}
]异常,StatusCode:
{
result
.
StatusCode
}
"
,
null
);
}
return
default
(
T
);
}
catch
(
Exception
ex
)
{
Program
.
_Context
.
Logger
.
Error
(
$"Get请求
{
service
}
服务异常."
,
ex
);
if
(
ex
.
InnerException
!=
null
)
Program
.
_Context
.
Logger
.
Error
(
$"Get请求
{
service
}
服务异常.InnerException"
,
ex
.
InnerException
);
}
finally
{
_httpclientPool
.
Return
(
_clientPoolObject
);
}
return
default
(
T
);
}
public
static
async
Task
<
T
>
PostAsync
<
T
>(
string
service
,
object
requestBody
)
...
...
@@ -65,12 +73,19 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
{
Program
.
_Context
.
Logger
.
Error
(
$"请求服务[
{
service
}
]异常,StatusCode:
{
result
.
StatusCode
}
"
,
null
);
}
return
default
(
T
);
}
catch
(
Exception
ex
)
{
Program
.
_Context
.
Logger
.
Error
(
$"Post请求
{
service
}
服务异常."
,
ex
);
if
(
ex
.
InnerException
!=
null
)
Program
.
_Context
.
Logger
.
Error
(
$"Post请求
{
service
}
服务异常.InnerException"
,
ex
.
InnerException
);
}
finally
{
_httpclientPool
.
Return
(
_clientPoolObject
);
}
return
default
(
T
);
}
public
static
T
Post
<
T
>(
string
service
,
object
requestBody
)
...
...
@@ -87,12 +102,19 @@ namespace GS.Terminal.VisitorSelfService.Logic.Remote
var
responseBody
=
result
.
Content
.
ReadAsStringAsync
().
Result
;
return
JsonConvert
.
DeserializeObject
<
T
>(
responseBody
);
}
return
default
(
T
);
}
catch
(
Exception
ex
)
{
Program
.
_Context
.
Logger
.
Error
(
$"Post请求
{
service
}
服务异常."
,
ex
);
if
(
ex
.
InnerException
!=
null
)
Program
.
_Context
.
Logger
.
Error
(
$"Post请求
{
service
}
服务异常.InnerException"
,
ex
.
InnerException
);
}
finally
{
_httpclientPool
.
Return
(
_clientPoolObject
);
}
return
default
(
T
);
}
}
}
Src/GS.Terminal.VisitorSelfService/ViewModelView/ViewModels/Pages/SubmitVisitInfoResult/ViewModel.cs
View file @
290dc647
using
GalaSoft.MvvmLight
;
using
GalaSoft.MvvmLight.Command
;
using
GS.Terminal.LogicShell.Interface
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -8,13 +9,37 @@ using System.Threading.Tasks;
namespace
ViewModels.Pages.SubmitVisitInfoResult
{
public
class
ViewModel
:
ViewModelBase
,
IViewModel
public
class
ViewModel
:
ViewModelBase
,
IViewModel
,
IViewModelBehavior
{
public
string
ViewID
=>
"cc808936-9d19-4e9c-86b7-3620cedd72fe"
;
private
int
_Downcount
;
public
int
Downcount
{
get
{
return
_Downcount
;
}
set
{
_Downcount
=
value
;
RaisePropertyChanged
(
"Downcount"
);
}
}
public
event
Action
OnGoHomeClicked
;
public
RelayCommand
GoHomeCommand
=>
new
RelayCommand
(()
=>
{
OnGoHomeClicked
?.
Invoke
();
});
public
void
Reset
()
{
}
public
event
Action
<
IViewModel
>
OnNavigateInto
;
public
void
NavigateInto
(
IViewModel
from
)
{
OnNavigateInto
?.
Invoke
(
from
);
}
public
event
Action
<
IViewModel
>
OnNavigateOut
;
public
void
NavigateOut
(
IViewModel
to
)
{
OnNavigateOut
?.
Invoke
(
to
);
}
}
}
Src/GS.Terminal.VisitorSelfService/ViewModelView/Views/Pages/SubmitVisitInfoResult/Index.xaml
View file @
290dc647
...
...
@@ -22,8 +22,10 @@
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="登记成功!" Foreground="#62ba67" FontSize="72" Margin="0,50,0,0"/>
<TextBlock Text="欢迎来访,您已获得通行权限可以在来访区域通行了!" FontSize="36" Margin="0,70,0,0"/>
<TextBlock Text="5秒后自动跳转至首页" Margin="0,216,0,0" FontSize="24"/>
<Button Width="460" Height="80" Margin="0,70,0,0" Template="{StaticResource CommonButton}" Content="返回首页" FontSize="36"/>
<TextBlock Text="{Binding Downcount,StringFormat={}{0}秒后自动跳转至首页}" Margin="0,216,0,0" FontSize="24"/>
<Button Width="460" Height="80" Margin="0,70,0,0"
Command="{Binding GoHomeCommand}"
Template="{StaticResource CommonButton}" Content="返回首页" FontSize="36"/>
</StackPanel>
</Grid>
</Page>
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