mirror of
https://github.com/maker-community/ElectronBot.DotNet.git
synced 2026-10-28 20:57:53 +08:00
hide todo view
This commit is contained in:
@@ -238,15 +238,15 @@ public partial class App : Application
|
||||
|
||||
services.AddTransient<IChatbotClientFactory, ChatbotClientFactory>();
|
||||
|
||||
services.AddSingleton<IHw75DynamicViewProvider, Hw75DynamicTodoViewProvider>();
|
||||
services.AddTransient<IHw75DynamicViewProvider, Hw75DynamicTodoViewProvider>();
|
||||
|
||||
|
||||
services.AddSingleton<IHw75DynamicViewProvider, Hw75DynamicCustomViewProvider>();
|
||||
services.AddTransient<IHw75DynamicViewProvider, Hw75DynamicCustomViewProvider>();
|
||||
|
||||
services.AddSingleton<IHw75DynamicViewProvider, Hw75DynamicWeatherViewProvider>();
|
||||
services.AddSingleton<IHw75DynamicViewProvider, Hw75DynamicYellowCalendarViewProvider>();
|
||||
services.AddTransient<IHw75DynamicViewProvider, Hw75DynamicWeatherViewProvider>();
|
||||
services.AddTransient<IHw75DynamicViewProvider, Hw75DynamicYellowCalendarViewProvider>();
|
||||
|
||||
services.AddSingleton<IHw75DynamicViewProviderFactory, Hw75DynamicViewProviderFactory>();
|
||||
services.AddTransient<IHw75DynamicViewProviderFactory, Hw75DynamicViewProviderFactory>();
|
||||
|
||||
services.AddGrpcClient<ElectronBotActionGrpc.ElectronBotActionGrpcClient>(o =>
|
||||
{
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
<ic:EventTriggerBehavior EventName="Loaded">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.LoadedCommand}" />
|
||||
</ic:EventTriggerBehavior>
|
||||
<ic:EventTriggerBehavior EventName="UnLoaded">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.UnLoadedCommand}" />
|
||||
</ic:EventTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
<Grid x:Name="LayoutRoot" Background="White">
|
||||
<Image Source="{x:Bind ViewModel.ClockTitleConfig.CustomHw75ImagePath, Mode=OneWay}" />
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
<ic:EventTriggerBehavior EventName="Loaded">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.LoadedCommand}" />
|
||||
</ic:EventTriggerBehavior>
|
||||
<ic:EventTriggerBehavior EventName="UnLoaded">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.UnLoadedCommand}" />
|
||||
</ic:EventTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="White">
|
||||
@@ -48,15 +51,15 @@
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="4"
|
||||
FontSize="24"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="24"
|
||||
Foreground="Black"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.Province, Mode=OneWay}" />
|
||||
<TextBlock
|
||||
Margin="4"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="24"
|
||||
Foreground="Black"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.City, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
@@ -71,18 +74,18 @@
|
||||
VerticalAlignment="Center"
|
||||
Source="{x:Bind ViewModel.GpsResult.Now.Icon, Mode=OneWay}" />
|
||||
<TextBlock
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="24"
|
||||
Foreground="Black"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.Temperature, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" HorizontalAlignment="Center">
|
||||
<TextBlock
|
||||
x:Name="WeatherInfo"
|
||||
FontSize="24"
|
||||
Margin="4"
|
||||
Foreground="Black"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="24"
|
||||
Foreground="Black"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.Skycon, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
@@ -91,9 +94,9 @@
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
x:Name="ftime"
|
||||
FontSize="12"
|
||||
Margin="4"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="12"
|
||||
Foreground="Black"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.Time, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
@@ -104,8 +107,8 @@
|
||||
<TextBlock
|
||||
x:Name="wind"
|
||||
Margin="4"
|
||||
FontSize="12"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="12"
|
||||
Foreground="Black"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.Wind, Mode=OneWay}" />
|
||||
|
||||
@@ -115,8 +118,8 @@
|
||||
x:Name="wind_sd"
|
||||
Margin="4"
|
||||
HorizontalAlignment="Center"
|
||||
FontSize="12"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="12"
|
||||
Foreground="Black"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.Wind_sd, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
@@ -124,9 +127,9 @@
|
||||
<TextBlock
|
||||
x:Name="Sunset"
|
||||
Margin="4"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="12"
|
||||
Foreground="Black"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.SunSet, Mode=OneWay}" />
|
||||
|
||||
|
||||
@@ -135,18 +138,18 @@
|
||||
<TextBlock
|
||||
x:Name="Sunrise"
|
||||
Margin="4"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="12"
|
||||
Foreground="Black"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.SunRise, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="8" HorizontalAlignment="Center">
|
||||
<TextBlock
|
||||
x:Name="Press"
|
||||
Margin="4"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
FontSize="12"
|
||||
Foreground="Black"
|
||||
FontFamily="/Assets/Font/fusion-pixel-12px-monospaced-zh_hans.ttf#Fusion Pixel 12px Monospaced zh_hans"
|
||||
Text="{x:Bind ViewModel.GpsResult.Now.Pressure, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
<ic:EventTriggerBehavior EventName="Loaded">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.LoadedCommand}" />
|
||||
</ic:EventTriggerBehavior>
|
||||
<ic:EventTriggerBehavior EventName="UnLoaded">
|
||||
<ic:InvokeCommandAction Command="{x:Bind ViewModel.UnLoadedCommand}" />
|
||||
</ic:EventTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="White">
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ComboxDataService
|
||||
new ComboxItemModel { DataKey = "Hw75CustomView", DataValue = "Hw75CustomView".GetLocalized() },
|
||||
new ComboxItemModel { DataKey = "Hw75WeatherView", DataValue ="Hw75WeatherView".GetLocalized() },
|
||||
new ComboxItemModel { DataKey = "Hw75YellowCalendarView", DataValue ="Hw75YellowCalendarView".GetLocalized() },
|
||||
new ComboxItemModel { DataKey = "TodoView", DataValue ="TodoView".GetLocalized() },
|
||||
//new ComboxItemModel { DataKey = "TodoView", DataValue ="TodoView".GetLocalized() },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using ElectronBot.Braincase.Contracts.Services;
|
||||
using ElectronBot.Braincase.Helpers;
|
||||
@@ -11,13 +10,10 @@ namespace ElectronBot.Braincase.ViewModels;
|
||||
|
||||
public partial class Hw75CustomViewModel : ObservableRecipient
|
||||
{
|
||||
private readonly DispatcherTimer _dispatcherTimer;
|
||||
private readonly DispatcherTimer _dispatcherTimer = new();
|
||||
|
||||
private readonly ILocalSettingsService _localSettingsService;
|
||||
|
||||
private ICommand _loadedCommand;
|
||||
public ICommand LoadedCommand => _loadedCommand ??= new RelayCommand(OnLoaded);
|
||||
|
||||
private string _todayWeek = DateTimeOffset.Now.ToString("ddd");
|
||||
|
||||
private ClockDiagnosticInfo _clockDiagnosticInfo = new();
|
||||
@@ -75,7 +71,9 @@ public partial class Hw75CustomViewModel : ObservableRecipient
|
||||
get => _todayTime;
|
||||
set => SetProperty(ref _todayTime, value);
|
||||
}
|
||||
private async void OnLoaded()
|
||||
|
||||
[RelayCommand]
|
||||
private async Task OnLoaded()
|
||||
{
|
||||
_dispatcherTimer.Start();
|
||||
|
||||
@@ -86,11 +84,17 @@ public partial class Hw75CustomViewModel : ObservableRecipient
|
||||
CustomContentVisibility = ClockTitleConfig.Hw75CustomContentIsVisibility ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
DateVisibility = ClockTitleConfig.Hw75TimeIsVisibility ? Visibility.Visible : Visibility.Collapsed;
|
||||
_diagnosticService.ClockDiagnosticInfoResult += DiagnosticService_ClockDiagnosticInfoResult;
|
||||
_diagnosticService.ClockDiagnosticInfoResult += DiagnosticService_ClockDiagnosticInfoResult;
|
||||
|
||||
Hw75Helper.Instance.InvokeHandler();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OnUnLoaded()
|
||||
{
|
||||
_dispatcherTimer.Stop();
|
||||
}
|
||||
|
||||
private void DiagnosticService_ClockDiagnosticInfoResult(object? sender, ClockDiagnosticInfo e)
|
||||
{
|
||||
App.MainWindow.DispatcherQueue.TryEnqueue(() =>
|
||||
@@ -108,12 +112,9 @@ public partial class Hw75CustomViewModel : ObservableRecipient
|
||||
Hw75Helper.Instance.InvokeHandler();
|
||||
}
|
||||
|
||||
public Hw75CustomViewModel(DispatcherTimer dispatcherTimer,
|
||||
ClockDiagnosticService clockDiagnosticService,
|
||||
ILocalSettingsService localSettingsService
|
||||
public Hw75CustomViewModel(ClockDiagnosticService clockDiagnosticService, ILocalSettingsService localSettingsService
|
||||
)
|
||||
{
|
||||
_dispatcherTimer = dispatcherTimer;
|
||||
_diagnosticService = clockDiagnosticService;
|
||||
_localSettingsService = localSettingsService;
|
||||
|
||||
|
||||
@@ -66,4 +66,10 @@ public partial class Hw75WeatherViewModel : ObservableRecipient
|
||||
|
||||
Hw75Helper.Instance.InvokeHandler();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OnUnLoaded()
|
||||
{
|
||||
_dispatcherTimer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,4 +40,10 @@ public partial class Hw75YellowCalendarViewModel : ObservableRecipient
|
||||
|
||||
Hw75Helper.Instance.InvokeHandler();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OnUnLoaded()
|
||||
{
|
||||
_dispatcherTimer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ public partial class Hw75ViewModel : ObservableRecipient, INavigationAware
|
||||
/// 表盘切换方法
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
private async Task ClockChanged()
|
||||
private void ClockChanged()
|
||||
{
|
||||
var clockName = ClockComBoxSelect?.DataKey;
|
||||
|
||||
@@ -88,9 +88,6 @@ public partial class Hw75ViewModel : ObservableRecipient, INavigationAware
|
||||
var viewProvider = _viewProviderFactory.CreateHw75DynamicViewProvider(clockName);
|
||||
|
||||
Element = viewProvider.CreateHw75DynamickView(clockName);
|
||||
|
||||
await Task.Delay(1000);
|
||||
await Hw75Helper.Instance.SyncDataToDeviceAsync(Element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user