From 117e56b6d26a09e8011ca8a81e0ca28b59bb7d1f Mon Sep 17 00:00:00 2001 From: YJammak Date: Tue, 24 Dec 2024 13:07:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96=E5=BA=93?= =?UTF-8?q?=EF=BC=8C=E6=9B=BF=E6=8D=A2=E5=BA=9F=E5=BC=83=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/CalendarWindow.xaml.cs | 9 ++++----- src/WeatherCalendar/Views/DayView.xaml.cs | 14 ++++++-------- .../Views/EditHolidayWindow.xaml.cs | 6 +++--- src/WeatherCalendar/Views/MainWindow.xaml.cs | 8 ++++---- .../Views/SelectCityWindow.xaml.cs | 8 ++++---- .../Views/SettingsWindow.xaml.cs | 19 ++++++++++--------- src/WeatherCalendar/WeatherCalendar.csproj | 5 +++-- 7 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/WeatherCalendar/Views/CalendarWindow.xaml.cs b/src/WeatherCalendar/Views/CalendarWindow.xaml.cs index 8ec780a..7e27c8c 100644 --- a/src/WeatherCalendar/Views/CalendarWindow.xaml.cs +++ b/src/WeatherCalendar/Views/CalendarWindow.xaml.cs @@ -1,11 +1,10 @@ -using ReactiveUI; -using Splat; -using System; +using System; using System.Reactive.Disposables; using System.Reactive.Linq; -using System.Windows; -using System.Windows.Controls.Primitives; using System.Windows.Input; +using ReactiveMarbles.ObservableEvents; +using ReactiveUI; +using Splat; using WeatherCalendar.Services; using WeatherCalendar.ViewModels; diff --git a/src/WeatherCalendar/Views/DayView.xaml.cs b/src/WeatherCalendar/Views/DayView.xaml.cs index 7d52bf9..b314c00 100644 --- a/src/WeatherCalendar/Views/DayView.xaml.cs +++ b/src/WeatherCalendar/Views/DayView.xaml.cs @@ -1,11 +1,12 @@ -using ReactiveUI; -using Splat; -using System; +using System; using System.Globalization; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using System.Windows; +using ReactiveMarbles.ObservableEvents; +using ReactiveUI; +using Splat; using WeatherCalendar.Themes; namespace WeatherCalendar.Views; @@ -380,7 +381,7 @@ private void WhenActivated(CompositeDisposable disposable) view => view.RemoveHolidayMenuItem) .DisposeWith(disposable); - this.ViewModel + ViewModel! .GetHolidayInfoInteraction .RegisterHandler(async interaction => { @@ -392,10 +393,7 @@ private void WhenActivated(CompositeDisposable disposable) editWindow.Show(); - while (editWindow.IsVisible) - { - await Task.Delay(10); - } + while (editWindow.IsVisible) await Task.Delay(10); if (editWindow.ViewModel!.IsConfirmed) interaction.SetOutput((editWindow.ViewModel!.HolidayName, editWindow.ViewModel!.IsRestDay)); diff --git a/src/WeatherCalendar/Views/EditHolidayWindow.xaml.cs b/src/WeatherCalendar/Views/EditHolidayWindow.xaml.cs index 8c71563..7d96b11 100644 --- a/src/WeatherCalendar/Views/EditHolidayWindow.xaml.cs +++ b/src/WeatherCalendar/Views/EditHolidayWindow.xaml.cs @@ -1,10 +1,10 @@ -using ReactiveUI; -using System; +using System; using System.Reactive; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Windows; -using System.Windows.Controls.Primitives; +using ReactiveMarbles.ObservableEvents; +using ReactiveUI; using WeatherCalendar.ViewModels; namespace WeatherCalendar.Views; diff --git a/src/WeatherCalendar/Views/MainWindow.xaml.cs b/src/WeatherCalendar/Views/MainWindow.xaml.cs index 2bf7879..4fa9b34 100644 --- a/src/WeatherCalendar/Views/MainWindow.xaml.cs +++ b/src/WeatherCalendar/Views/MainWindow.xaml.cs @@ -1,13 +1,13 @@ -using ReactiveUI; -using Splat; -using System; +using System; using System.Reactive; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Windows; -using System.Windows.Controls; using System.Windows.Forms; using System.Windows.Media; +using ReactiveMarbles.ObservableEvents; +using ReactiveUI; +using Splat; using WeatherCalendar.Services; using WeatherCalendar.Themes; using WeatherCalendar.Utils; diff --git a/src/WeatherCalendar/Views/SelectCityWindow.xaml.cs b/src/WeatherCalendar/Views/SelectCityWindow.xaml.cs index 9e9c1c1..4f65b25 100644 --- a/src/WeatherCalendar/Views/SelectCityWindow.xaml.cs +++ b/src/WeatherCalendar/Views/SelectCityWindow.xaml.cs @@ -1,10 +1,10 @@ -using ReactiveUI; -using System; +using System; using System.Reactive; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Windows; -using System.Windows.Controls.Primitives; +using ReactiveMarbles.ObservableEvents; +using ReactiveUI; using WeatherCalendar.ViewModels; namespace WeatherCalendar.Views; @@ -94,7 +94,7 @@ private void WhenActivated(CompositeDisposable disposable) mode => mode.UpdateWeatherCommand, view => view.OkButton); - this.ViewModel + ViewModel! .UpdateSuccessInteraction .RegisterHandler(interaction => { diff --git a/src/WeatherCalendar/Views/SettingsWindow.xaml.cs b/src/WeatherCalendar/Views/SettingsWindow.xaml.cs index 860711a..91f036b 100644 --- a/src/WeatherCalendar/Views/SettingsWindow.xaml.cs +++ b/src/WeatherCalendar/Views/SettingsWindow.xaml.cs @@ -1,12 +1,12 @@ -using ReactiveUI; -using System; +using System; using System.Globalization; using System.IO; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Windows; -using System.Windows.Controls.Primitives; -using System.Windows.Forms; +using Microsoft.Win32; +using ReactiveMarbles.ObservableEvents; +using ReactiveUI; using WeatherCalendar.ViewModels; namespace WeatherCalendar.Views; @@ -159,14 +159,15 @@ private void WhenActivated(CompositeDisposable disposable) .Click .Select(_ => { - var dialog = new FolderBrowserDialog(); - dialog.UseDescriptionForTitle = true; - dialog.Description = @"选择天气图标路径"; + var dialog = new OpenFolderDialog + { + Title = "选择天气图标路径" + }; - if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) + if (dialog.ShowDialog() != true) return null; - return dialog.SelectedPath; + return dialog.FolderName; }) .Where(path => !string.IsNullOrWhiteSpace(path) && Directory.Exists(path)) .BindTo(this, window => window.ViewModel.CustomWeatherIconPath) diff --git a/src/WeatherCalendar/WeatherCalendar.csproj b/src/WeatherCalendar/WeatherCalendar.csproj index 665d6bd..79e4818 100644 --- a/src/WeatherCalendar/WeatherCalendar.csproj +++ b/src/WeatherCalendar/WeatherCalendar.csproj @@ -12,6 +12,7 @@ YJammak 天气日历 https://github.com/YJammak/Weather + True @@ -30,12 +31,12 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - +