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
43f5a9e5
Commit
43f5a9e5
authored
May 26, 2024
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 中午12点自动重启客户端。临时解决客户端占内存2G问题
parent
a3159a6a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
246 additions
and
4 deletions
+246
-4
SectionStyle2.xaml
...ntrolLibrary/FLY.ControlLibrary/Themes/SectionStyle2.xaml
+1
-1
UcSectionReboot.xaml
...Base/FLY.Thick.Base.UI/CustomSection/UcSectionReboot.xaml
+40
-0
UcSectionReboot.xaml.cs
...e/FLY.Thick.Base.UI/CustomSection/UcSectionReboot.xaml.cs
+87
-0
FLY.Thick.Base.UI.csproj
...FLY.Thick.Base/FLY.Thick.Base.UI/FLY.Thick.Base.UI.csproj
+8
-0
OnInitReboot.cs
...t.FLY.Thick.Base/FLY.Thick.Base.UI/OnInit/OnInitReboot.cs
+96
-0
ParamDistItemKeys.cs
...ect.FLY.Thick.Base/FLY.Thick.Base.UI/ParamDistItemKeys.cs
+1
-0
StringResource.PgCustomSections.xaml
...emes/StringResources/StringResource.PgCustomSections.xaml
+7
-2
StringResource.PgCustomSections.xaml
...s/StringResources/en/StringResource.PgCustomSections.xaml
+6
-1
No files found.
Project.FLY.ControlLibrary/FLY.ControlLibrary/Themes/SectionStyle2.xaml
View file @
43f5a9e5
...
...
@@ -14,7 +14,7 @@
<Setter Property="Foreground" Value="White" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="FontSize" Value="30" />
<Setter Property="FontFamily" Value="
Microsoft Sans Serif
" />
<Setter Property="FontFamily" Value="
{StaticResource FontFamily.Field}
" />
<Setter Property="TextAlignment" Value="Right" />
</Style>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/CustomSection/UcSectionReboot.xaml
0 → 100644
View file @
43f5a9e5
<UserControl x:Class="FLY.Thick.Base.UI.CustomSection.UcSectionReboot"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FLY.Thick.Base.UI.CustomSection"
mc:Ignorable="d" >
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Converters.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:UcSectionRebootVm x:Key="viewModel"/>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel Orientation="Horizontal" >
<Border Style="{StaticResource Styles.ParamSection.Border}">
<TextBlock Text="{StaticResource str.PgCustomSections.Reboot}" />
</Border>
<StackPanel d:DataContext="{StaticResource viewModel}">
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="{StaticResource str.PgCustomSections.AutoRebootAt12}" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding IsAutoReboot}" />
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="{StaticResource str.PgCustomSections.BootTime}" />
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding BootTimeMin}" />
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="{StaticResource str.PgCustomSections.Min}"/>
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable.Row2}" Text="测试:立即重启" />
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" HorizontalAlignment="Left" IsChecked="{Binding IsReBootAtOnce}" />
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</UserControl>
Project.FLY.Thick.Base/FLY.Thick.Base.UI/CustomSection/UcSectionReboot.xaml.cs
0 → 100644
View file @
43f5a9e5
using
CommunityToolkit.Mvvm.Input
;
using
FLY.AppHelper
;
using
FLY.Thick.Base.UI.OnInit
;
using
Misc
;
using
MultiLayout.UiModule
;
using
System.Collections.ObjectModel
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Windows
;
using
System.Windows.Controls
;
using
Unity
;
namespace
FLY.Thick.Base.UI.CustomSection
{
/// <summary>
/// UcSectionOsk.xaml 的交互逻辑
/// </summary>
public
partial
class
UcSectionReboot
:
UserControl
{
UcSectionRebootVm
viewModel
;
public
UcSectionReboot
()
{
InitializeComponent
();
}
[
InjectionMethod
]
public
void
Init
(
ParamDictionary
paramDictionary
,[
Dependency
(
"reboot"
)]
IOnInit
onInitReboot
)
{
viewModel
=
new
UcSectionRebootVm
();
viewModel
.
Init
(
paramDictionary
,
(
OnInitReboot
)
onInitReboot
);
this
.
DataContext
=
viewModel
;
}
}
public
class
UcSectionRebootVm
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
/// <summary>
/// 自动重启电脑
/// </summary>
public
bool
IsAutoReboot
{
get
;
set
;
}
/// <summary>
/// 开机时间
/// </summary>
public
int
BootTimeMin
{
get
;
set
;
}
public
bool
IsReBootAtOnce
{
get
;
set
;
}
ParamDictionary
paramDictionary
;
OnInitReboot
onInitReboot
;
public
UcSectionRebootVm
()
{
}
public
void
Init
(
ParamDictionary
paramDictionary
,
OnInitReboot
onInitReboot
)
{
this
.
paramDictionary
=
paramDictionary
;
this
.
onInitReboot
=
onInitReboot
;
IsAutoReboot
=
paramDictionary
.
GetValue
(
ParamDistItemKeys
.
AutoReboot
,
false
);
BootTimeMin
=
onInitReboot
.
BootTimeMin
;
IsReBootAtOnce
=
onInitReboot
.
IsReBootAtOnce
;
this
.
PropertyChanged
+=
UcSectionRebootVm_PropertyChanged
;
onInitReboot
.
PropertyChanged
+=
OnInitReboot_PropertyChanged
;
}
private
void
OnInitReboot_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
nameof
(
onInitReboot
.
BootTimeMin
))
{
BootTimeMin
=
onInitReboot
.
BootTimeMin
;
}
}
private
void
UcSectionRebootVm_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
nameof
(
IsAutoReboot
))
{
paramDictionary
.
SetValue
(
ParamDistItemKeys
.
AutoReboot
,
IsAutoReboot
);
}
else
if
(
e
.
PropertyName
==
nameof
(
IsReBootAtOnce
))
{
onInitReboot
.
IsReBootAtOnce
=
IsReBootAtOnce
;
}
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base.UI/FLY.Thick.Base.UI.csproj
View file @
43f5a9e5
...
...
@@ -102,6 +102,9 @@
<Compile
Include=
"CustomMenu\UpdateMenu.cs"
/>
<Compile
Include=
"CustomMenu\WarningMenu.cs"
/>
<Compile
Include=
"CustomMenu\PwMenu.cs"
/>
<Compile
Include=
"CustomSection\UcSectionReboot.xaml.cs"
>
<DependentUpon>
UcSectionReboot.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"CustomSection\UcSectionLanguage.xaml.cs"
>
<DependentUpon>
UcSectionLanguage.xaml
</DependentUpon>
</Compile>
...
...
@@ -124,6 +127,7 @@
<Compile
Include=
"IErrNoTranslator.cs"
/>
<Compile
Include=
"OnInit\OnInitAutoScan.cs"
/>
<Compile
Include=
"OnInit\OnInitControllerState.cs"
/>
<Compile
Include=
"OnInit\OnInitReboot.cs"
/>
<Compile
Include=
"OnInit\OnInitWarnings.cs"
/>
<Compile
Include=
"OnInit\OnInitError.cs"
/>
<Compile
Include=
"OnInit\OnInitOSK.cs"
/>
...
...
@@ -249,6 +253,10 @@
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Page
Include=
"CustomSection\UcSectionReboot.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Page
Include=
"CustomSection\UcSectionLanguage.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/OnInit/OnInitReboot.cs
0 → 100644
View file @
43f5a9e5
using
MultiLayout.UiModule
;
using
Misc
;
using
System
;
using
System.Collections.Generic
;
using
System.Globalization
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Unity
;
using
System.ComponentModel
;
using
FObjBase
;
namespace
FLY.Thick.Base.UI.OnInit
{
/// <summary>
/// 虚拟键盘
/// </summary>
public
class
OnInitReboot
:
IOnInit
,
INotifyPropertyChanged
{
ParamDictionary
paramDictionary
;
public
OnInitReboot
(
ParamDictionary
paramDictionary
,
int
lv
=
1
)
{
this
.
paramDictionary
=
paramDictionary
;
Level
=
lv
;
}
public
int
Level
{
get
;
}
/// <summary>
/// 自动重启电脑
/// </summary>
public
bool
IsAutoReboot
{
get
;
protected
set
;
}
/// <summary>
/// 开机时间
/// </summary>
public
int
BootTimeMin
{
get
;
protected
set
;
}
public
bool
IsReBootAtOnce
{
get
;
set
;
}
bool
isRebooting
=
false
;
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
void
OnInit
()
{
IsAutoReboot
=
paramDictionary
.
GetValue
(
ParamDistItemKeys
.
AutoReboot
,
false
);
paramDictionary
.
ValueChanged
+=
ParamDictionary_ValueChanged
;
PollModule
.
Current
.
Poll_Config
(
OnPoll
,
TimeSpan
.
FromMinutes
(
1
));
}
private
void
ParamDictionary_ValueChanged
(
object
sender
,
ParamDictionaryValueChangedEventArgs
e
)
{
if
(
e
.
Key
==
ParamDistItemKeys
.
AutoReboot
)
{
IsAutoReboot
=
paramDictionary
.
GetValue
(
ParamDistItemKeys
.
AutoReboot
,
false
);
}
}
/// <summary>
/// 1min 调用一次
/// </summary>
void
OnPoll
()
{
BootTimeMin
++;
if
(
IsAutoReboot
)
{
if
(
IsReBootAtOnce
&&
BootTimeMin
>
1
)
{
reboot
();
}
else
if
(
BootTimeMin
>
60
*
12
)
{
//12小时后, 到了中午12点,重启软件
if
(
DateTime
.
Now
.
Hour
==
12
)
{
reboot
();
}
}
}
}
void
reboot
()
{
if
(!
isRebooting
)
{
isRebooting
=
true
;
//重启软件
FLY
.
AppHelper
.
AppJustOne
.
Restart
();
}
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base.UI/ParamDistItemKeys.cs
View file @
43f5a9e5
...
...
@@ -16,5 +16,6 @@ namespace FLY.Thick.Base.UI
public
const
string
WindowSize
=
"WindowSize"
;
public
const
string
SkipWarningUnityNames
=
"SkipWarningUnityNames"
;
public
const
string
XStep
=
"XStep"
;
public
const
string
AutoReboot
=
"AutoReboot"
;
}
}
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Themes/StringResources/StringResource.PgCustomSections.xaml
View file @
43f5a9e5
...
...
@@ -6,7 +6,7 @@
<!--字符串换行 换行符 -->
<system:String x:Key="str.PgCustomSections.Title">客户端设置</system:String>
<system:String x:Key="str.PgCustomSections.AutoChangedPage" xml:space="preserve">自动
3
;页面切换</system:String>
<system:String x:Key="str.PgCustomSections.AutoChangedPage" xml:space="preserve">自动
0
;页面切换</system:String>
<system:String x:Key="str.PgCustomSections.State" >状态</system:String>
<system:String x:Key="str.PgCustomSections.Page" >页面</system:String>
<system:String x:Key="str.PgCustomSections.AlarmTip" >报警提示</system:String>
...
...
@@ -18,7 +18,7 @@
<system:String x:Key="str.PgCustomSections.OSK" >虚拟键盘</system:String>
<system:String x:Key="str.PgCustomSections.SupportMouse" >支持鼠标</system:String>
<system:String x:Key="str.PgCustomSections.ScanGraph" xml:space="preserve" >图表
3
;总体设置</system:String>
<system:String x:Key="str.PgCustomSections.ScanGraph" xml:space="preserve" >图表
0
;总体设置</system:String>
<system:String x:Key="str.PgCustomSections.XStep" >X轴间隔</system:String>
<system:String x:Key="str.PgCustomSections.SelectMusicFile" >打开音乐文件</system:String>
...
...
@@ -26,4 +26,9 @@
<system:String x:Key="str.PgCustomSections.Language">语言</system:String>
<system:String x:Key="str.PgCustomSections.Apply">应用</system:String>
<system:String x:Key="str.PgCustomSections.Reboot" xml:space="preserve">自动 重启</system:String>
<system:String x:Key="str.PgCustomSections.AutoRebootAt12" xml:space="preserve">中午12点自动 重启客户端</system:String>
<system:String x:Key="str.PgCustomSections.BootTime">启动时间</system:String>
<system:String x:Key="str.PgCustomSections.Min">分钟</system:String>
</ResourceDictionary>
\ No newline at end of file
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Themes/StringResources/en/StringResource.PgCustomSections.xaml
View file @
43f5a9e5
...
...
@@ -6,7 +6,7 @@
<!--字符串换行 换行符 -->
<system:String x:Key="str.PgCustomSections.Title">Client App Setting</system:String>
<system:String x:Key="str.PgCustomSections.AutoChangedPage" xml:space="preserve">Auto

;Page</system:String>
<system:String x:Key="str.PgCustomSections.AutoChangedPage" xml:space="preserve">Auto


;Page</system:String>
<system:String x:Key="str.PgCustomSections.State" >State</system:String>
<system:String x:Key="str.PgCustomSections.Page" >Page</system:String>
<system:String x:Key="str.PgCustomSections.AlarmTip" >Alarm Tip</system:String>
...
...
@@ -25,4 +25,9 @@
<system:String x:Key="str.PgCustomSections.Language">Language</system:String>
<system:String x:Key="str.PgCustomSections.Apply">Apply</system:String>
<system:String x:Key="str.PgCustomSections.Reboot" xml:space="preserve">Auto Reboot</system:String>
<system:String x:Key="str.PgCustomSections.AutoRebootAt12" xml:space="preserve">The App reboots automatically at PM 12:00 </system:String>
<system:String x:Key="str.PgCustomSections.BootTime">Boot Time</system:String>
<system:String x:Key="str.PgCustomSections.Min">Mins</system:String>
</ResourceDictionary>
\ No newline at end of file
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