mirror of
https://github.com/maker-community/ElectronBot.DotNet.git
synced 2026-10-26 02:59:40 +08:00
update clock view
This commit is contained in:
@@ -60,10 +60,10 @@
|
||||
MaxWidth="120"
|
||||
Margin="2"
|
||||
HorizontalAlignment="Right"
|
||||
FontSize="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontSize="{x:Bind ViewModel.BotSetting.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontWeight="Bold"
|
||||
Foreground="White"
|
||||
Text="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitle, Mode=OneWay}"
|
||||
Text="{x:Bind ViewModel.BotSetting.CustomClockTitle, Mode=OneWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -55,16 +55,16 @@ public sealed partial class CustomClockView : UserControl
|
||||
|
||||
var blurAmount = 4.0f;
|
||||
|
||||
if (ViewModel.ClockTitleConfig != null)
|
||||
if (ViewModel.BotSetting != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ViewModel.ClockTitleConfig.CustomViewPicturePath))
|
||||
if (!string.IsNullOrEmpty(ViewModel.BotSetting.CustomViewPicturePath))
|
||||
{
|
||||
imgPath = ViewModel.ClockTitleConfig.CustomViewPicturePath;
|
||||
imgPath = ViewModel.BotSetting.CustomViewPicturePath;
|
||||
}
|
||||
|
||||
blurAmount = ViewModel.ClockTitleConfig.GaussianBlurValue;
|
||||
blurAmount = ViewModel.BotSetting.GaussianBlurValue;
|
||||
|
||||
if (!ViewModel.ClockTitleConfig.CustomViewContentIsVisibility)
|
||||
if (!ViewModel.BotSetting.CustomViewContentIsVisibility)
|
||||
{
|
||||
PomodoroPanel.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
xmlns:local="using:ElectronBot.Braincase.ClockViews"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:xaml="using:Microsoft.Graphics.Canvas.UI.Xaml"
|
||||
Unloaded="UserControl_Unloaded"
|
||||
Background="Black"
|
||||
Unloaded="UserControl_Unloaded"
|
||||
mc:Ignorable="d">
|
||||
<i:Interaction.Behaviors>
|
||||
<ic:EventTriggerBehavior EventName="Loaded">
|
||||
@@ -146,10 +146,10 @@
|
||||
MaxWidth="120"
|
||||
Margin="2"
|
||||
HorizontalAlignment="Right"
|
||||
FontSize="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontSize="{x:Bind ViewModel.BotSetting.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontWeight="Bold"
|
||||
Foreground="White"
|
||||
Text="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitle, Mode=OneWay}"
|
||||
Text="{x:Bind ViewModel.BotSetting.CustomClockTitle, Mode=OneWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -66,9 +66,9 @@
|
||||
Margin="0,12,0,12"
|
||||
HorizontalAlignment="Center"
|
||||
FontFamily="/Assets/Font/SmileySans-Oblique.ttf#得意黑"
|
||||
FontSize="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontSize="{x:Bind ViewModel.BotSetting.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
Foreground="White"
|
||||
Text="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitle, Mode=OneWay}" />
|
||||
Text="{x:Bind ViewModel.BotSetting.CustomClockTitle, Mode=OneWay}" />
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<Grid VerticalAlignment="Center">
|
||||
<controls:RadialGauge
|
||||
|
||||
@@ -58,10 +58,10 @@
|
||||
MaxWidth="120"
|
||||
Margin="2"
|
||||
HorizontalAlignment="Right"
|
||||
FontSize="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontSize="{x:Bind ViewModel.BotSetting.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontWeight="Bold"
|
||||
Foreground="White"
|
||||
Text="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitle, Mode=OneWay}"
|
||||
Text="{x:Bind ViewModel.BotSetting.CustomClockTitle, Mode=OneWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
MaxWidth="120"
|
||||
HorizontalAlignment="Left"
|
||||
FontFamily="{StaticResource TimeFont}"
|
||||
FontSize="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontSize="{x:Bind ViewModel.BotSetting.CustomClockTitleFontSize, Mode=OneWay}"
|
||||
FontWeight="Bold"
|
||||
Foreground="White"
|
||||
Text="{x:Bind ViewModel.ClockTitleConfig.CustomClockTitle, Mode=OneWay}"
|
||||
Text="{x:Bind ViewModel.BotSetting.CustomClockTitle, Mode=OneWay}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
<Grid>
|
||||
|
||||
@@ -5,10 +5,11 @@ using ElectronBot.Braincase.Contracts.Services;
|
||||
using ElectronBot.Braincase.Models;
|
||||
using ElectronBot.Braincase.Services;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Models;
|
||||
|
||||
namespace ElectronBot.Braincase.ViewModels;
|
||||
|
||||
public class ClockViewModel : ObservableRecipient
|
||||
public partial class ClockViewModel : ObservableRecipient
|
||||
{
|
||||
private readonly DispatcherTimer _dispatcherTimer;
|
||||
|
||||
@@ -42,19 +43,14 @@ public class ClockViewModel : ObservableRecipient
|
||||
|
||||
private string _customClockTitle;
|
||||
|
||||
private CustomClockTitleConfig _clockTitleConfig;
|
||||
|
||||
public string CustomClockTitle
|
||||
{
|
||||
get => _customClockTitle;
|
||||
set => SetProperty(ref _customClockTitle, value);
|
||||
}
|
||||
|
||||
public CustomClockTitleConfig ClockTitleConfig
|
||||
{
|
||||
get => _clockTitleConfig;
|
||||
set => SetProperty(ref _clockTitleConfig, value);
|
||||
}
|
||||
[ObservableProperty]
|
||||
private BotSetting _botSetting;
|
||||
|
||||
public ClockDiagnosticInfo ClockDiagnosticInfo
|
||||
{
|
||||
@@ -73,9 +69,9 @@ public class ClockViewModel : ObservableRecipient
|
||||
{
|
||||
_dispatcherTimer.Start();
|
||||
|
||||
var ret2 = await _localSettingsService.ReadSettingAsync<CustomClockTitleConfig>(Constants.CustomClockTitleConfigKey);
|
||||
var botSetting = await _localSettingsService.ReadSettingAsync<BotSetting>(Constants.BotSettingKey);
|
||||
|
||||
ClockTitleConfig = ret2 ?? new CustomClockTitleConfig();
|
||||
BotSetting = botSetting ?? new BotSetting();
|
||||
|
||||
_diagnosticService.ClockDiagnosticInfoResult += DiagnosticService_ClockDiagnosticInfoResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user